While doing intial coding, putting comments within the code can be useful - DoingStuff.DonaldNoyes.20141117
Particularly with those who are not employed to write code, but who write programs to get personally assigned tasks done. In my career as a Controls Engineer, I would write programs in Basic, or use scritps in DatabaseThree?, to organize and link together various facets of my work. I would build my own version of the Instrumentation List which was weeks and months ahead of the Organizational List prepared as the Offical Listing.
It ended up being helpful in the preparation of Wiring Diagrams, Loop Sheets, Schematics, and for organizing and placing of Junction Boxes and Hubs throughout the factory, site, or refinery complex. I used a documentation style using comments in the code, for various reasongs including reminders of some things to be added, some things to be further organized, and for marking beginnings and endimgs.
A somewhat different concept of documentation within code is practiced by those who use programs they write to get stuff done. It is oriented toward increasing personal, not organization (except indirectly) productivity, and is a GoodThing for those who are SelfDogFooding.