Your Code Need Comments. Code comments often make everyone’s life easier, including your future-self.
Code comments are an interesting topic that’s often subject to heavy debate, and programmers hold almost religious views on the matter. So, I thought, why not have a go at this one, as I do with the whole “not using if-else” and traditional branching.
Commenting on your code is like telling the same story twice. Except, one may get out of sync with reality and starts becoming a lie instead. Code should ideally be self-documenting and annotating it with
// or # only increases the signal-to-noise ratio, for the worse.
That’s at least the mindset developers nowadays have converged on.
Many developers thoughtlessly spurt out things like “your code must be self-documenting,” “good code doesn’t need comments,” “commenting code is a bad idea,” or “comments are code-smells.” These are likely all versions of what you’ve been told throughout the years.
But let me tell you this little secret:
Using comments properly can vastly increase system and application comprehension.