When he pointed me at the offending code, I instantly realised why he was smiling. Here's my candidate for best comment ever:
static const long INITIAL_PING_SECONDS_REMAINING = 100; //TODO: Needs to be 200For a few seconds I was stumped. This can't be my code! What was I thinking???? Then it hit me and I remembered what I'd done. I set the constant to 100 during development to make it quicker to debug so I put the TODO there to remind myself to put it back to 200 when finished. Nothing wrong with that of course, but I could have saved myself considerable embarrassment if a) the comment was a little more descriptive like "TODO: 100 for debugging, remember to change back to 200" maybe and b) if I actually checked my TODO's before committing!
Oh well, lessons learned I guess :-)
2 comments:
Priceless!
One way to avoid these kinds of issues: instead of hard-coding debug vs. production things like this, make a "profile" or "config" class/module that encapsulates all these. Then it's just a matter of remembering to use the production config when you go live - which is hard to forget, since there's usually something glaringly wrong if you don't.
Post a Comment