|
|
|
|
|
by EEGuy
4848 days ago
|
|
Expressing "The Five Ws"[1] (plus the "How") in and about code, adapts that excellent journalistic tradition [1]. I'm constantly trying to find a balance. Definitely the "Why" of a code change is most difficult to self-document. A style I've used for decades, a bit wordy, but useful in merging change sets, keeps a change log at the top of every module / source file naming the person making a change (who), dating the change (when), tagging it with a pseudo-html tag [wrapping an area of code changes in the body of the source file] (what and where), and at the top, a reference to the failure case or test case (why) explaining why it was necessary to make this change. When one change spans multiple files, I dedicate one source file to contain the detail, and all the others make reference comments to the one source file containing the detail. [1] https://en.wikipedia.org/wiki/Five_Ws |
|
Also, a changelog only documents the why of modifications, not the why of existence of a class, function, etc.