{ Code: Impossible } | this = HowI.Roll();

TAG | code-comments

Jul/08

22

Code comments = respect

I was browsing around Code Project the other day, I subscribe to their most recent submissions feed to watch for interesting samples, and I saw a unique take on a logging system.

It used IL replacement, much like TypeMock Isolator, to allow developers to enable/disable the logger without having to compile any code.

In theory, I haven’t tried it out yet, you would be able to add this logging system to any project without coding anything.

I downloaded the code and it’s huge. 5 assemblies, over 2000 lines and there is some COM stuff in there. I notice two things. First it’s all in c++. This is not a bad thing it’s just not my first language.

So I start looking around for some comments to let me know what the heck is going on in this code.

Annnnnnd… hmmmm thats odd.

There are no comments. Not one. I checked the author notes on the original submission article to see if this was an error and there was an updated link.

Nope. Nothing. It takes me a minute but near the bottom of the post I see why there are no comments.

The author writes:

“I like to think I write self-documenting code so I tend to not have any comments in my code.”

I instantly deleted the code from my system. My thought is if the author of this code didn’t think it was worthy of some kind of explanation then I am certainly not going to waste my time with it.

Comments aren’t just some “nice to have” thing. They show that you actually care about what you are putting out there and they show your thought process throughout the codes execution. If you don’t care about that then why would I?

I’m not saying that every line, function call and variable needs a comment but any programmer worth his salt should put some form of documentation into his/her code. It’s a sign of respect.

So my fellow developers let’s respect each other enough to document what we put out into the world. What do you say?

· ·

Theme Design by devolux.nh2.me