Standards of Practice: Code Commenting Style Preferences and Recommendations
Hawke Robinson
Full & Fractional Technology Leader & Architect. Developer (AI, Brain Computer Interface, BCI, Neurotechnology, Neurotech), also known as "The Grandfather of Therapeutic Gaming", Recreational Therapist, & Researcher.
Too many programmers in the past 10-15 years (though always a struggle with coders, it has recently gotten much worse) increasingly seem to consider code commenting and documentation passe ("just read the code!" they say) and that it is too time consuming without enough benefit to justify the effort (unfortunately they are simply outright wrong). However, for those that understand the value of good and useful code comments, here are some suggested guidelines...
This can apply to any programming language. I've been online and coding since 1979, and I sometimes slip and say "REM the code there" or "see my remarks in the code", to which most younger developers look very puzzled, and I adjust to "comment out the code there" and "see my comments in the code". :)
I'll not go into a long rant (this time) about how critically important code comments are to proper, professional, and maintainable code with this article, you either grok it or you don't. (verbally patting those on the head who don't grok it yet).
Everyone has their own writing style, this includes books, blogs, coding, documentation, and code comments.
Here is my preferred approach, which perhaps others may find beneficial, including the reasons why I take this approach.
This style of commenting allows for a more open interpretation of the code's intentions. This approach can be beneficial in several ways:
领英推荐
This commenting style approach encourages critical thinking:
The style of keeping comments more neutral and professional by avoiding "we/our" can help maintain a more objective and professional tone in the codebase. This more thoughtful approach to code comments documentation can help promote? more robust and evolving codebases.
Happy Coding!
This is excellent advice and guidance. Developers who take this approach also help "future-proof" their code in a couple of way: 1. This makes it easier to remember and understand the goals of the code at the time of writing which, in turn, makes it easier to iterate as the code evolves. 2. It allows others who come after to figure out the intended functionality after you've moved to another role or company.
1% Better everyday | Life Hacks | The Project Management Software for Modern Teams | Project Planning, Resource Management, Portfolio Monitoring, Website Designing, Project Request Tracking, Lead & Revenue Generation.
1 个月Great insight, Hawke!