DEV Community

Discussion on: 10 Tips to Write Clean Code

Collapse
 
socratezz profile image
Andy Edmonds

Solid post. I would extend the comments section to include two types of comments. First is a hack comments for when you have to put a working, but bad code block in to meet a deadline. I try to isolate this code it it's own function or class so the comment doesn't interrupt the flow. Second is answering why the code has business logic that is abnormal or a deviation from the rules the rest of the code follows. There is always a stakeholder who requests weird things at the last minute.

I completely agree about the comments telling me what the code does. I always delete those when I see them. Too much effort to maintain code and a comment in that situation.

Collapse
 
awedis profile image
awedis

Yepp 100%, if a code has been written in a really good way, I believe the comments will be just a distraction

Collapse
 
mmayboy_ profile image
O ji nwayo e je

We need a downvote button urgently