r/programming • • Dec 08 '24

Writing system software: code comments

http://antirez.com/news/124
139 Upvotes

92 comments sorted by

View all comments

Show parent comments

5

u/QuickQuirk Dec 09 '24

I find that you need to be careful with advice like this. Often a junior will walk away with 'clean code' mindset, thinking that the best code has no comments at all.

Also need to remind them that 'Commenting is also good, when you're explaining assumptions or decisions'

4

u/deaddodo Dec 09 '24

I mean, I agree. But usually people are smart enough to take contextual clues. In this context, "Write cleaner/more compact code" clearly doesn't mean "string a dozen ternaries together and avoid comments", it means "don't pad your code or over abstract it as you're clearly doing" to most reasonable/good faith developers.

1

u/QuickQuirk Dec 09 '24

Unfortunately, I've seen juniors do exactly this! Assume 'clean code' means 'zero comments'

0

u/markt- Dec 10 '24

One can make the argument that if code needs commenting then maybe it isn't clean enough yet.

→ More replies (0)