views:

30

answers:

5

I'm not sure if this is an appropriate question. If not, then remove without mercy.

I've frequently encountered source code comments with questions in them. Like

//Are we ever gonna need this?
//todo: may be this should be moved some place else?

I've written such comments myself. What I never did in my life is answer those questions from others and never cared if someone else answered mine. Am I a bad person? Is it common? Do those doubts and inquiries haunt your source code too?

+1  A: 

The obvious action here is to convert the comments into issues in your bug tracking software. It's what I do. Oftentimes when I find myself writing a comment like that, I either make the decision immediately, or formalise it in the form of a bug of feature in Trac.

Noon Silk
A: 

Add a step to your build process that identifies all TODO (and HACK etc) comments.

Then create work items and go and fix them!

Mitch Wheat
+1  A: 
Am I a bad person?

No, you are not

Is it common?

I haven't seen a project without them until now (except my personal ones :))

Do those doubts and inquiries haunt your source code too?

Not my source code (I always fix those) but source code that I inherited from others and had to maintain (but with no budget allocated for refactoring - which basically limits your choice to adding that sort of comments for later generations to come).

user21982
A: 

//TODO: comments are perfectly valid PROVIDED you do something with them. The current project I'm on has about 10, all related to some features that will be implemented later this year. They're useful.

The other comment is less helpful and serves no real purpose other than as an outlet for frustration/confusion.

I'm not a huge fan of comments. If your methods, classes, and variables are well-named you shouldn't need many of them. Consider these examples:

//This method updates the customer
private void Update(object me)

or

private void UpdateCustomer(object customer)

Comments become outdated quickly and can lead to confusion months down the road.

Chuck
A: 

I put TODOs everywhere. I don't consider it a bad habit.. just a way of getting some of my thoughts down. I'm also one of those people who writes EVERYTHING down, its probably related. Its never been a problem for me - its just easier than remembering to do it later. I've never worked somewhere that uses bug tracking either and I think that has something to do with it.

rmx