DEV Community

100 Bytes Of Wisdom: Day 25

Alt Text

I find that when I'm working on a particularly tricky bit of code, my first instinct is to leave a comment explaining what it is and what it does. I stop my self and then ask myself, cool. I figured out the hard bit of code to write. But the problem is only half solved. Huh? Yup, the next problem to solve is to make sure the next developer (or future me) can understand what I've done. Comments are one way to achieve this, but ultimately, your code should do the talking - and it should talk very clearly. So write the code again, this time with readability in mind. And for a third time, if you have to.

Heads up: As with any terse bit of advice, there will be exceptions of course, and subtleties and nuance that can't possibly be captured in a Byte of Wisdom. This has been what I've experienced, I'd love to hear yours in the comments too!

You can catch up with all the other bytes at http://bytesofwisdom.com/

Discussion (0)