The Importance of Comments for Maintainable Code

I’ve always been a fan of commenting code. To me, it’s a no brainer, the sensible thing to do, and a fundamental part of building software that’s easy to understand and maintain. Not everyone agrees though. Some argue that comments are unnecessary and simply shine a light on code that isn’t as expressive as it should be. In this post, I’ll try to counter those arguments and tell you why I think quality comments are an important part of building software that easier to understand and maintain.

Sometimes, building code is like any other building project.
You may also like: Should I Read Books as a Software Developer?

Helping Others Understand Your Code

As developers, we spend a considerable amount of time reading and trying to understand other people's code. At times this can be a difficult and frustrating task. Most of us have been in a situation where we’re neck-deep in legacy code with no documentation, no unit tests and not a comment in sight. Chances are the guy who wrote it isn’t around anymore and we’re left to our own devices to figure out WTF is going on. Not much fun, is it?