Why Comment?

Home · Blog

2 February 2025

Back in September, I wrote an article on Code Comments, about how I like to write comments when programming. That topic has been on my mind again recently and I want to explore another aspect: why do I like to write comments?

Most programmers don’t seem to enjoy writing comments or documentation, but somehow I’ve always been different. For some reason, I actually like to spend the time to write good comments and I’ll do it unless I’m told not to.

I think I’ve finally figured out the reason why: it’s because it makes programming more fun.

Let me explain what I mean. Writing comments, and especially writing good comments, takes some effort. It’s not just the time to type them in -- writing useful comments forces you to think about your code, why it’s written a certain way, what’s important about it, and so on. On the flip side, it saves time and effort when you’re reading code: without comments you have to spend extra time to figure out the information that could have been in comments, which often amounts to guesswork because that information is exactly the things you can’t easily get from reading code. You might also have to spend extra time debugging if you guessed wrong.

For me, thinking about the design and implementation of code is fun (that’s why I became a software engineer), while trying to guess how some piece of code works is annoying. And debugging issues that could have been avoided is also annoying. So commenting makes programming more fun. The fact that it also makes your team more productive is a nice bonus.

I like automated testing for the same reason. Writing tests is just programming, so it means more time spent programming and less debugging. More fun.