DEV Community

Discussion on: Do Code Comments Deserve a Special Spot or Can Well-Written Code Speak for Itself?

Collapse
 
ephilips profile image
Eesaa Philips

I used to think code should always be self-explanatory until I had to work on complex systems which had odd behaviors you simply couldn't explain without comments. This is especially true if you're doing something like bit shifting, pointer offsets, etc. where the reader cannot easily discern what the code does just by looking at it. Clean Code advocates would tell you to wrap it in a function that basically explains what it does but I strongly disagree.