Document Intentions

Documenting your code is almost always a good thing, but bad documentation does more harm than good. Documentation that is vague, misleading, incorrect, or outdated causes confusion and frustration. Writing good documentation is hard because you not only have to correctly explain what your code is doing (which can be a challenge), but you have to do so in a way that is precise and will not get outdated. One of the best ways to do this is to document what your code is intended to do rather than what your code is actually doing.

Get Learning to Program now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.