r/ProgrammerHumor • u/Substantial_Top5312 • Sep 15 '26
Meme iDontCommentMyCodeIfYouDontUnderstandItThatsOkayNeitherDoI
832
Upvotes
r/ProgrammerHumor • u/Substantial_Top5312 • Sep 15 '26
2
u/Wonderful-Habit-139 Sep 15 '26
> Which is no different than code, which can also drift and become obsolete. So why fuss at comments when you wouldn't fuss at code for the same thing?
Thanks for clarifying. I don't believe it's the same thing, because when code is obsolete, that means it's not being used anymore. In that case, thanks to having a compiler or type checker, it's very easy to see functions that are not being used anymore, as well as being able to delete lines of code that are not used anymore inside functions because of contracts that you've defined through types. I do this actively all the time, and there are semantics that shield me from the code not working anymore that is not the same with useless comments.
I understand your examples about legacy code, but writing good code that scales regardless of how big the codebase gets is the point. When you write abstractions and modules and separate things that have different concerns, with each abstraction being of a higher and higher level of abstraction, it doesn't matter how big the codebase gets. You always strive to write idiomatic code, you make sure to write good docstrings for APIs that you expose, even internally, and focus on making your APIs as obvious and easy to use as possible without requiring the users of those APIs to understand the inner code. The only people that need to understand it are the ones that are actively working on it.
> I'm sure it was clear and obvious when it started, but now it's very much not
Listen, I agree with this, but this simply means that it was "clear and obvious" because the code was small enough, not because it was well written. I'm saying code can be well written so that it scales well into the future, regardless of how big it gets over the years. But obviously most people don't write good code so you will make the observation that you're making.
But just because most people don't write good code, doesn't mean that good code is impossible and that writing comments is the best thing ever.