Tool Mismatch
by Lidor Wyssocky

Tool20061031

When I was just starting my way as a software developer I worked in a team writing simulators and other tools for testing engineers. Most of the tools I wrote were 100% my creation. I designed them, I wrote them, and I provided support for them. This gave me a chance to control almost every aspect of development (except, of course, for the requirements and the deadline). Most of the time it was a lot of fun. Most of the time…

One of my responsibilities was to provide support for one of our mythological creations. It was the it-can-do-anything-you-can-possibly-imagine simulator (but we just called it: the ICDAYCPI-Sim). Almost every testing engineer in our department used it. Needless to say that unlike most of the things I was responsible for, I didn’t design this tool, and I didn’t write it. In fact, for a whole year I didn’t even see it. Most of the time it worked perfectly well for most of its users. Most of the time…

Then, one morning as I opened my mailbox, my biggest fear became a reality. There, at the top of my inbox, was a mail with the subject “urgent fix needed in the ICDAYCPI-Sim”.

At first, I panicked. After a couple of minutes, I pulled myself together and did what every software developer in the world would have done: I fixed myself a strong cup of coffee. Then, I fixed myself another one. I went back to my desk and started to search the mythological project. Even that task was not trivial. “Good start” I thought to myself.

When I eventually found the project, I started to wish I hadn’t. I gazed at the IDE-less UNIX shell, which was filled with what seemed to be an endless list of C files. Each file contained thousands of lines. And naturally, there was not even a single README file to provide me a hint on where to start. I knew the fix I had to implement was extremely simple. I just had to change the length of some field in the parsing sequence. How hard could that be? Well, it can be extremely hard when you have no idea where to start looking for the relevant piece of code.

I stared at the screen for a few more minutes, and then I did the next thing that every software developer in the world would have done: I launched the debugger. A week later the fix was implemented (it took me two more days, though, to build the project, but that’s for another post).

Backspace001

***

Wikipedia defines a debugger as “a computer program that is used to test and debug other programs”. Debugging is then defined as “a methodical process of finding and reducing the number of bugs, or defects, in a computer program”. Now, let’s be honest: how many of us are using a debugger for things that have nothing to do with finding the source of a bug? Unfortunately, most of us do.

The debugger seems to be the number one tool for understanding a piece of code. Many of us use it whenever we come across a piece of code we don’t understand. This may be a legitimate approach when you have a badly written undocumented piece of code you have to work with. The problem is many of us keep writing such code because we subconsciously (or consciously) assume a debugger is the perfect tool for understanding code. Well, it isn’t.

Trying to understand a piece of code using a debugger, stepping into each line, and therefore reading each line in isolation, is a tedious and ineffective task. It’s like trying to understand a picture by seeing one pixel at a time. When code is self-describing and its high-level structure is intelligently documented, it is relatively easy for someone new to the code to find his way in it.

But there are even stranger uses for a debugger. Some developers, for example, use a debugger to verify that their code works correctly. The technique is quite simple. You write a simple main method to launch your code and provide it with some input. Then, you use a debugger to follow the execution of the code step-by-step. All this is done with various inputs and without any reported bug you are trying to locate. You are just “testing” your code. How long does each such test take to execute? Very long! Believe it or not, some developers out there use this technique as a replacement for automated unit testing. No, it’s not because the tests they want to use are hard to automate. It’s because they truly believe that using a debugger is the most effective way to test your code. Period.

***

To be honest, the way we use a debugger is just one example of a wider phenomenon. Many of us misuse tools. We think we are leveraging a tool by using it in some innovative way. But most of the time this misuse leads to a waste of valuable time and resources.

There’s a lot of room for innovation even when it comes to the way you use your toolbox. But what ever you do, you must always verify that you are on the right track. There’s nothing innovative in using a debugger for unit testing or for trying to understand the structure and logic of 100,000 lines of code. Unless, of course, you’re trying to come up with innovative ways to waste time.

Share this post:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • BlinkList
  • Reddit
  • digg
  • NewsVine
  • blogmarks
  • Furl
  • Netvouz
  • Spurl
  • YahooMyWeb

Optimize Your Software Development

See how I can help you develop software more effectively

10 Responses to “Tool Mismatch”

  1. Tom Harris Says:

    Yes, having and using the right tool for the right job makes all the difference. And for your readers who do other things besides programming …

    http://talkaboutquality.wordpress.com/2006/05/04/choose-and-use-the-right-tools/

  2. Lidor Wyssocky Says:

    Are there any…?

    ;)

  3. gman Says:

    In the past when I’ve been put on an existing project and I need to learn the code I usually rely on my editor (slickedit). I build the tags for the project and then follow through the code. Like a debugger I can pop into a function or method and pop back out to where it was called and quickly figure out the general flow.

  4. pdq Says:

    Typo: “I didn’t wrote it”

  5. Lidor Wyssocky Says:

    Thanks for the review pdq ;)

    Lidor

  6. Brad Bellomo Says:

    So just because someone is using a tool to do something other what wikipedia defines it as, they are wrong?

    If a tool actual helps someone be more productive, even if it is not what was intended, then they are making good use of the tool.

    If they are using the tool to do what the company selling the tool intended but not what Wikipedia feels the tool should do, then either the company is mismarketing their tool, or (more likely) Wikipedia needs updating.

    If a debugger is making someone less productive then they otherwise would be, then they really do need to stop.

  7. Lidor Wyssocky Says:

    Hi Brad,

    Of course, you can use a tool for other purposes than what it was originally defined for. But always check your cost vs. value.

    In other words, just the fact that you _can_ use a tool in a certain way, doesn’t mean you should. Maybe there’s a better way to do it.

    Sounds trivial, but still so many of us have different experiences….

    Lidor

  8. wow gold may Says:

    In World of Warcraft, wow gold is gamesavor.
    If you are looking for world of warcraft gold, You can buy cheap wow gold from us,and the wow gold will deliver to you fast and safe.

  9. gold wow Says:

    Hello,your homepage looks very good. I really like it.Can you give me a feedback about my homepage?You can buy wow gold or powerleveling service for World of Warcraft.Hope to see you soon.

  10. jeep1688 Says:

    [url=http://www.baidu.com]Good luck for you[/url]

    Good luck for you

Leave a Reply