Self-Documenting Code

One possible solution to not writing bad documentation is to write no documentation at all. Woo hoo! No documentation! Before you get too excited, let me explain. Modern programming languages can be quite descriptive, to the point that the code can read almost as clearly as plain English. If your code reads like plain English, what need have you for comments in plain English? None! I don’t fully buy into this idea myself, but some programmers out there believe that descriptive, self-documenting code is enough—no comments necessary. They even say that this is better than code with comments; if the code is the documentation, the documentation is never outdated. This argument has a lot of merit, and the principles behind self-documenting ...

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.