Thursday, June 23, 2005

What an Amazing (Code) Smell You've Discovered

I'm naming a new code smell today, "Obsessive Tracing." You know exactly what I mean. If you see a long method or class with a *lot* of Debug.WriteLine("1") or Debug.WriteLine("I'm in here now!") methods sprinkled throughout the code, it's a good bet the code smells to high heaven. Those trace statements are in there because the code is prone to breaking and hard to understand.

The point of a code smell is to recognize a problem so you can begin to move in a different direction. I'm not sure what you do with legacy code, but with new code the key in my opinion is a well factored solution for ease of understanding and strong unit testing. Excessive amounts of debugging often means your unit testing isn't granular and comprehensive enough. Excessive debug statements might also mean a developer could benefit from reading up on the capabilities of their debugger.



Geek points for nailing the movie line in the title. No Chris Fields you don't count, that one's too easy for you.

6 Comments:

Blogger Bil Simser said...

Star Wars, Episode III. Han says it to Leia when they haul it down into the garbage chute (right before he fires off his primitive blaster and nearly kills everyone).

3:43 PM, June 23, 2005  
Blogger Bil Simser said...

Argh. Make that Episode IV. My brain just isn't working today.

3:43 PM, June 23, 2005  
Anonymous Colin Kershaw said...

To be precise, "Star Wars Episode IV: A New Hope". Great (blog) title.

5:06 PM, June 28, 2005  
Anonymous Steve Hebert said...

JSP

9:45 AM, June 29, 2005  
Anonymous steve hebert said...

thread.sleep(0)

8:34 AM, July 06, 2005  
Anonymous Anonymous said...

Is there is a balance between the salary and the demanding
job. ll understand what you have to do in order to solve
your basic problems. Also, be sure to have both the training and experience, which are needed before you even think of applying.
My site :: vuceveem.2itb.com

6:57 PM, December 29, 2012  

Post a Comment

<< Home