Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Related to this: the worst part of all this “Clean code” mindset, it is the idea that having comments in the code is somewhat harmful, because “if there is a comment, the code is not simple enough”.

Currently in my second workplace that belongs to that “school of thought”.



If you have a block of code and feel that the block warrants an explanation, that block of code should receive a name instead. A block of code with a name. Behold: a function. Abstraction! Scary!

I do think things like types and functions should be documented, and on rare occasions there are tricks which can only reasonably be explained using code comments, but those are extremely rare.


Yes you’re right, but sometimes in interpreted languages it’s difficult to understand what the function does. Python resolves this problem via type-hinting, Ruby relies on comments (although there are some approaches like sorbet).


I believe the higher the mean seniority (as in time in the same workplace) gets the more a programming workplace resembles a cult.


WTF. There are really "anti comment" people out there?! That blows my mind.


Yes, in their view they think that a code comment implies code that needs to be refactored, yes I’m not kidding.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: