7

I 'd say yes - I am really annoyed to no end seeing autogenerated comments from the IDE left in code snippets in stackoverflow, a la :

@Override
public void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    // 20 lines of code apparently _not_ autogenerated
}

It is a waste of space, distracting and as ugly as poor coding practices ever were - cause it is a very poor coding practice

When I say and the like one thing that comes to mind immediately in android is :

/** Called when the activity is first created. */

yak ! are you telling me cause you think I don't know ? what kind of answer do you expect from me then ?

But what is the community stance ?

  • 1
    I've been here awhile, and this is the first time I've actually seen this happen. Is it common enough to warrant a system change just to detect this specifically? – user102937 Jul 17 '13 at 21:28
  • 1
    @RobertHarvey: Oh I meant manual edit. Common ? See for yourself : stackoverflow.com/… :D – Mr_and_Mrs_D Jul 17 '13 at 21:30
  • Generally, leaving a comment asking for clarification is the best approach to these kinds of scenarios. – user102937 Jul 17 '13 at 21:31
  • 2
    It seems like 21.5k out of 25.7k of questions containing "// TODO Auto-generated method stub" have the [Android] tag. – Old Checkmark Jul 17 '13 at 23:12
  • @doubleDown : oh yes – Mr_and_Mrs_D Jul 17 '13 at 23:47
  • 1
    @RobertHarvey : no clarification is needed - one mostly immediately sees it's just the copy pasted code from the IDE (and because I'm on android on Eclipse as most people I recognize this instantly) – Mr_and_Mrs_D Jul 17 '13 at 23:49
  • My OCD side says "YES PLEASE", my pragmatic side, says "Leave the children alone!" – Diederik Apr 24 '14 at 12:03
6

If this is the only thing you are editing, I would leave it alone. The comment is pretty innocuous, and code edits always carry the risk (however minor) of obscuring the original problem. Additionally, presence of such comments may help to inform answerers about the OP's level of experience.

However, if the post contains enough such comments to substantially extend the length of the code block and you are editing to correct other issues as well, I don't see much harm in removing it.

| improve this answer | |
  • No I would not bother if it's the only thing (except if I would) - but yes actually I do edit them out (when I edit a post) - more (most) often than not they come with other goodies. I do also consider if the info on the OP's level of experience is important - usually it can be deduced anyway – Mr_and_Mrs_D Jul 17 '13 at 21:34
1

The person that posts code with these comments left in is either:

  • Too inexperienced to know the difference
  • Too lazy to particularly care.

In either case, if you know that it doesn't change anything, then it's just as easy not to bother them with it and to ignore it.

On another note, edits should always improve the post. I don't see this edit really adding much to the post.

| improve this answer | |
  • 5
    Oh yes it does - it often removes a scrollbar - and for me it is plain irritating anyway. If I am to revisit the snippet I'd rather not lay eyes again on TODO autogenerated catch block It most certainly has nothing to do with the question. We should make a list actually – Mr_and_Mrs_D Jul 17 '13 at 21:27
-1

My personal preference would be to use a regular expression to replace [ \t]*//[ \t]*TODO[ :\t] with #error Not yet done - in the actual code every time I see something like this in any code shown to anybody. (I have actually had organisations deliver "Finished" code that had numerous functions that contained nothing but the auto-generated TODO.

Then again I have been known to loose my temper on occasion...

| improve this answer | |
  • makes sense, makes sense – Mr_and_Mrs_D Jul 17 '13 at 23:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .