Bad
Modified structure to include a linked list (12/20/2007 MT).
Why include the date and username?- this is known from other information in the repository.
Worse
Modified structure to include a linked list.
What about this information could not be derived from a cursory glance at the source code changes?
Fair
The linked list was added to the caching structure to support a LRU ejection policy.
Too general. A naive understanding of caches would have been sufficient to derive this information.
Better
Without the linked list component, the caching structure would often exhibit suboptimal performance. Adding the linked list component is part of an effort to implement a more effective LRU caching policy.
Much improved, but it could be more specific.
Best
Modified caching structure to include an LRU ordered linked list. Hereafter, the cache will more effectively decrease latencies for read-only database access. This change was necessary because the prior suboptimal performance of the cache often resulted in unacceptably long latencies. This problem was especially prevalent on the user account screen.
Perfect.
Template:
- One sentence describing the implemented change: Modified caching...
- One sentence describing the desired result: Hereafter...
- Two sentences describing why the change was necessary: This change was necessary...
Admittedly, any sort of support for these suggestions is likely to be anecdotal. After all, there haven't been any multi-year studies comparing poor and superior repository comment practices. However, I'd prefer to include an scenario that, though anecdotal, nevertheless illustrates the value of concise and informative repository comments.
Suppose that several years later, the user account screen is completely reworked to use asynchronous database accesses. It is unclear whether the referenced database caching scheme needs to be reworked to support asynchronous accesses (no small task), or completely discarded. A good set of repository comments would prove invaluable in this case. Knowing the reasoning behind the original change empowers the developer to identify potential risks in future development.
The repository commentary permits a developer to decrease the complexity of source code comments. A good repository comment should cover historical information about the software. In most cases, this historical information can therefore be omitted from the source code commentary.
Including more information in source control comments also has the potential to convict the implementer. A well-written but incorrect change description can reveal how little one knows about the problem being solved. Because the repository commentary is more visible, it is unlikely to be overlooked. That sort of information is invaluable to the project team- but harmful to the individual developer's ego. If you are writing a repository comment, and you fear this scenario, remember the G.I. Joe mantra: knowing is half the battle. Egos are expendable.