I got tired and debugged! 22

Posted by Uncle Bob Thu, 21 Dec 2006 00:02:00 GMT

My grandaughter slept over last night. She’s an early riser. She and I had breakfast at 6am. My wife got a new cell phone (TREO680) yesterday, and I helped her set it up. So I didn’t go to bed until late. In short, I didn’t get a lot of sleep.

A bunch of us are working on a new training example for object oriented design principles and patterns. It’s a large-ish web-based system that has lots of interesting lessons to learn. We’ll be presenting it as a series of exercises throughout the course. Anyway, we’ve all been working as a team, writing this software. It’s been a lot of fun!

Anyway, about 3pm I started to get really tired. I should have stopped. But I wanted to finish one last story! (You know the feeling.) So I pressed on.

I ran accross a small dependency problem between two of the classes. So I started an elaborate refactoring to resolve the issue. An hour later I had to back out the whole refactoring because it didn’t solve the problem, or even come close! I don’t know what I was thinking. The real solution was much simpler and took just 10 minutes or so to implement. I should have stopped then, but, well, you know…

I needed to leave at 5pm. By 4:30 I was executing my unit tests. There was a problem. It didn’t make sense. You know the kind! I stared at the code for a long time, but my brain was mush. I couldn’t think. The lines of code swam before my eyes, but did not speak to me. I should have stopped then.

But no. Instead, I did something I barely ever do. Something I haven’t done in many months. I set a breakpoint! Egad! I was single-stepping through the code. And then I would do that horrible little dance where you step to a point in a module and realize you’ve gone a step or two too far. The variables don’t make sense. So you start over, and step back to just before where you were. Hideous! I should have stopped! But I kept at it. Over and over, breaking, stepping, breaking, stepping.

Debuggers feed you a torrent of information. Even when you are awake it’s easy to misread them. When tired, you see what you want to see, not what you really see. And nothing I saw made any sense. I finally got to the point where an if statement comparing two identical strings was failing! (Or so I thought.) I demanded that the stupid machine was lying. I rebuilt the application. I rebooted my machine. I redid the breakpoint, over and over. No change.

Now it was after 5pm. I really needed to go. I also really needed to fix this damned problem and check in the code. So I did the only thing that might make a bit of sense (other than stopping, which is what I should have done 2 hours before), I turned off the debugger and asked my pair-partner James for some help.

James had been busy helping one of the other guys get subversion working with Eclipse, so he’d been somewhat distracted while I was spinning myself into a debug rathole. He came right over and looked at my unit test. He said “Oh, shouldn’t that fravitz be a dorvitz?”

...

Duh. Yes, that fravitz should have been a dorvitz. It was obvious. It was simple. It was a 2 second change, and the tests all passed. (sigh).

So I, once again, reinforce my rule about debuggers. They are a horrible time-sink. When you find you must debug, it’s time to get help or go home.

Comments

Leave a response

  1. Avatar
    Aaron Guan 19 days later:

    Hello Uncle Bob,

    It is really an interesting story about debugger. Sometimes, if you have an urge to use debugger, there must be some mess in your code, or you just get too tired to understand it.

    But Uncle Bob, what does “fravitz” & “dorvitz” mean? Are they some kind of data structure in your code?

  2. Avatar
    Robert W. about 1 month later:

    I disagree.

  3. Avatar
    John Lee over 3 years later:

    Sometimes it is better to cut your losses, take off early and come back with a fresh mind. Its worked everytime for me and I was more productive afterwards.

  4. Avatar
    ipad to itunes transfer over 3 years later:

    it is really good

    is the best choice for

    iPad fans to transfer iPad Music/Video/Photos/TV Shows/Podcasts etc to iTunes, With it, you can

    not only copy files from iPad directly to iTunes, but also can backup iPad content to your

    iTunes or PC local discs. Besides, it also has the function of transferring

  5. Avatar
    Ray Cook over 4 years later:

    At the very 1st, I’d prefer to state thanks to you for this enlightening post. 2nd, I’d prefer to doubt wheresoever I can determine a lot more data related to your article. I arrived right here through Yahoo and can not find out any linked up web websites connected to this matter. How do I sign for your web blog? I’d choose to stick to your updates as they arrive along! I had a query to interrogate but I forgotten what it absolutely was… anyway, thank you very much.

  6. Avatar
    clothing button over 4 years later:

    Orologi Rolex is a comparison shopping search engine based in hangzhou hotel Brian Smith’s Rolex Uhr very detailed yet refreshingly gucci handbags.zf

  7. Avatar
    dvdsoft over 4 years later:

    And if you download the right software, you can burn MP4 to DVD. How to remove DRM protection from M4V, WMV, M4P, AAC, M4A, WMA, OGG, iTunes, Napster, Rhapsody legally? So that you can burn iTunes to DVD or convert DRM files to other unprotected formats.WMV to DVD, MOV to DVD, DRM Removal Tool, MP4 to DVD

  8. Avatar
    Criminal Check over 4 years later:

    Thanks for this informative post. Keep posting good and useful information.

  9. Avatar
    Free Articles over 4 years later:

    Current IT operation

  10. Avatar
    Criminal Records over 4 years later:

    Debuggers feed you a torrent of information. Even when you are awake it’s easy to misread them. When tired, you see what you want to see, not what you really see.

  11. Avatar
    Tenant Screening over 4 years later:

    The lines of code swam before my eyes, but did not speak to me. I should have stopped then.

  12. Avatar
    Seo Firm India over 4 years later:

    Hi, i enjoy reading your website or blog. I got many ideas for my blog. Thanks for the info

  13. Avatar
    okey oyunu oyna over 4 years later:

    thank you uncle bob, nice informaiton

  14. Avatar
    funny pictures over 4 years later:

    yeah agreed but some of you guys just create bias comments

  15. Avatar
    hi good luck over 5 years later:

    The pv energy system, developed, designed, engineered Solar Module and produced by Cenergy Power, addresses additional than four acres of soil in the Parlier complex.

  16. Avatar
    hi good luck over 5 years later:

    Our pv method will spend Multicrystalline Module for by itself in much less than five years,

  17. Avatar
    hi good luck over 5 years later:

    As component on the pv arrangement, additionally towards design, engineering Polycrystalline Solar Module and set up on the pv system

  18. Avatar
    discount cigarettes online over 5 years later:

    cigarettes online, there is a tremendous interest in natural health throughout the world. This interest is causing the study of Natural Health to cheap cigarettes shop

    momentum, and students are enrolling in course studies at an astonishing rate. Unfortunately, this growth has lured some institutions to “jump on the

    bandwagon” to develop natural health programs that are in many instances under-par. We are glad to offer you quality programs that will provide cigarettes online sale

    background in this popular field of study. You’ll be mentored and guided by professionals and experts with doctorate degrees who’ve been in marlboro cigarettes for sale

  19. Avatar
    bryan over 5 years later:

    Thanks it is nice and valuable sharing. hp apollo p-2200 ink

  20. Avatar
    bahria town lahore over 5 years later:

    Good work! I always like to leave comments whenever I see something unusual or impressive. I think we must appreciate those who do something especial. Keep it up, thanks Ingrit Ray

  21. Avatar
    brother ink over 5 years later:

    Thanks it is really great post.

  22. Avatar
    Fitflop over 5 years later:

    A great post, thanks for taking the time to share, continued success to your site in the future! GOOD Work!!

Comments