DEV Community

Discussion on: CSS Clean Code

Collapse
 
hasnaindev profile image
Muhammad Hasnain • Edited

Robert C. Martin argues against this is book. If you have to write comments in order to explain your code, it is most likely that the code you wrote is already bad and has code smells. Code should describe comments rather than the other way around.

Although this doesn't mean you should avoid comments. Writing good comments is something anyone would recommend. For instance, documenting your code as in JSDocs or PHPDocs. You can use it to write "TODOs." Generally, low level operations should be abstracted away. You could comment the low level abstractions if it is complex but yeah.

There are no hard and fast rules. If you give your code to me and I understand it quickly (clean code) and can make modification in it without breaking anything (loosely coupled) then that's great!