A few handy pointers to keeping your code readable:
Some programmers include comments as part of self-documenting code. In this article, we’ll only focus on code. Comments are important, but they’re a large topic to be covered separately.
We can split the techniques for self-documenting code into three broad categories:
- structural, where the structure of code or directories is used to clarify the purpose
- naming related, such as function or variable naming
- syntax related, where we make use of (or avoid using) features of the language to clarify code.
Many of these are simple on paper. The challenge comes from knowing when to use what technique. I’ll show you some practical examples as we tackle each one.