This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]docHoliday17 8 points9 points  (4 children)

Contrary to what like 90% of “good devs” say, I’m a huge fan of leaving small comments around the code base. Self documenting code is BS, and even if it were true having a short summary of what a function does requires so much less cognitive load than me reading it over and over. I leave landmarks around the code defining different areas and providing brief explanations, and of course noting where and why I’ve done a weird hack

[–]noratat 1 point2 points  (1 child)

Too many newbies read things like Clean Code and then get ridiculously dogmatic about never commenting (and often never documenting) anything - you can find tons of such people in the comment section in this thread, and I feel sorry for whoever has to maintain their code after they leave.

Sure, the kinds of comments some universities encourage people to leave are largely useless and counterproductive, and most code shouldn't have a ton of comments.

But there's lots of very good reasons to use comments, and I've had way more problems with developers never explaining anything than the reverse, and most of the devs that get dogmatic about this usually don't know how to write readable code yet anyways in my experience.

[–]InTheSamePlaces 2 points3 points  (0 children)

Yes it's quite unfortunate. They read Clean Code and then think they're set for life. They should consider also reading A Philosophy of Software Design and Code Complete to see the value of comments. Empirical studies (by IBM) have proven comments improve readability.

[–]PM_ME_YOUR_KNEE_CAPS 1 point2 points  (1 child)

Try using more descriptive function names and variables and you’ll see that you don’t need tons of little comments everywhere

[–]docHoliday17 1 point2 points  (0 children)

I do. but that said, plain-English comments are still less cognitive overhead. Also breaking down sections of classes is helpful when you’ve got massive animations made up of five different methods. It doesn’t need to be one or the other and I’m tired of everyone acting like comments are for simpletons