DEV Community

Discussion on: "Do not comment on your code, it should be self-documented". Well... I don't agree.

Collapse
 
tonyknibbmakarahealth profile image
TonyTheTonyToneTone

I tend to comment my code in blocks, so I can find blocks that do stuff, without having to digest each and every line of code. I know what the code does when I read it but... why would I want to read it if I don't have to?

I do agree that you shouldn't need to comment every single line. That would be ludicrous.

Commenting functions/classes/methods and blocks of code is just good practice imo. Six months from now I don't want to have to strain my brain, reading 50,000 lines of code, to find a block of code that needs updating. ¯_(ツ)_/¯