DEV Community

Discussion on: Top 5 Bad Coding Practices — Avoid Them to All costs!

Collapse
 
darkes profile image
Victor Darkes

Good list! Personally documentation over commenting, because comments can get stale and functionality within a function can change rendering comments obsolete. The popular CS book Clean Code by Robert Martin goes into that.

Collapse
 
blarzhernandez profile image
Roberto Hernandez

Yes, sure. Thanks for sharing it too.

Collapse
 
aminmansuri profile image
hidden_dude

Having dealt with millions of lines of code.. I think comments are essential.. and the modern trend of saying it isn't is just a cop out of lazy programming.

Comments should be written and maintained.

Collapse
 
darkes profile image
Victor Darkes

Definitely not a modern trend. People who forgo commenting are not lazy. It forces you to write clear and concise methods. Tests and documentation are far more important. If comments are essential for everything then the code isn't clear. When someone writes comments and leaves the company there's no way to understand their intention if their comment doesn't make sense. The code is the only source of truth. I work with large codebases and I'd say a good portion of comments aren't applicable to the codebase by the time I'm looking at it. Things have changed and the code represents the change and not the comments. I'm not against commenting, I definitely do it if there's a "gotcha" with the business requirements, but it's a personal preference rather than a sign of a lazy programmer.