Comments are always Wrong

I was taking a break.

I worked at a big game company. My group was porting a PC game to the Amiga. Mostly I was rewriting the slowest parts in 68000 assembly language. We worked all sorts of odd hours, but no matter what hours I was in there, I always got sleepy an hour after lunch, so I walked around to wake up.

We had a nice Atrium with some indoor trees and a restaraunt in the building. Lots of places to go, even in rainy Eugene. Stairs to walk up and down.

I ended up in the big office where the three guys programming the football game sat. I was social with all three. We all had families or were soon to have them.

Their window was open. There was a cool breeze, and you could hear teenagers and buses outside. It was nice. I could sit there and shoot the bull for maybe 10 minutes before getting kicked out.

DaveM was running a batch or a grep or something on some source file he was looking at.

Bang, all the comments were gone. He leaned in and started looking at code.

 

No Comment

“Where did the comments go?,” I asked.

“Comments are always wrong. You should never look at them.”

Wow. This was great. My day had gone from drab to peacock in a blink. There was nothing, nothing better than an argument that started with one of Dave’s provocative statements.

“Well that can’t be true. Some comments must be right.”

Dave and I had managed to distract TimM and GlenW. Tim offered, “All of mine are wrong.” Glen laughed.

This was serious business to Dave.

 

The Code is the Code

“The code is the code. That’s what runs. If you read the comment, it’ll tell you what the guy meant to do, but the guy probably wrote it wrong anyway. And it’s probably changed twice since then. If you believe the comment, you won’t really look to see what the code is doing.”

Glen said, “My favorite kind of comment is the one that says, ‘increment m.'”

“Yeah, and there’s no m anywhere in the file anymore,” Tim joked.

“I just don’t want to see them,” stressed Dave, “they don’t help anyone.”

“Most of my comments mark the places where I don’t know what I’m doing,” I said. I was getting into it. “They say, ‘I should look at this again,’ or, ‘I should do this a better way.'”

Tim said, “Let me look at my comments… Here’s one. It says, ‘I don’t know why this works.'”

Dave said, “I believe that one.”

“Yeah,” Tim said. “Maybe all my comments aren’t wrong after all.”

3 Comments

  1. I always thought Tim was the smartest one in the room. Now I know for sure.

  2. juliejulie, your comment is wrong. Comments are always wrong.

  3. The tests are what the programmer should have done.

    The code is what the programmer actually did.

    The comments are what they thought they were doing.


Comments RSS TrackBack Identifier URI

Leave a comment