CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Jeremy D. Miller -- The Shade Tree Developer

Under the hood and working with .Net, TDD, Software Design, and Agile Stuff

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.
 
The original post with comments is at http://jeremydmiller.blogspot.com/2005/06/what-amazing-code-smell-youve.html.  I think it took about 15 minutes for someone to give me the movie title.

Published Jul 20 2005, 06:19 PM by Jeremy D. Miller
Filed under:

Comments

Raymond Lewallen said:

Code with lots of Debug.WriteLines probably have cyclomatic complexities into the 20s, and instead of recognizing the need to refactor so its easier to debug, they stink up the code.
# July 20, 2005 12:21 PM

Sahil Malik [MVP C#] said:

Jeremy Miller, the latest codebetter addition, blogged about an Amazing code smell - in which he basically...
# July 20, 2005 9:28 PM

Sahil Malik [MVP C#] said:

Jeremy Miller, the latest codebetter addition, blogged about an Amazing code smell - in which he basically...
# July 20, 2005 9:30 PM

Steve Hebert's Development Blog said:

I was reading Jeremy Miller's post on Code Smells
and another classic .Net code smell occurred to me. ...
# July 21, 2005 7:42 AM

Steve Hebert's Development Blog said:

I was reading Jeremy Miller's post on Code Smells
and another classic .Net code smell occurred to me. ...
# July 21, 2005 7:53 AM

Steve Hebert's Development Blog said:

I was reading Jeremy Miller's post on Code Smells
and another classic .Net code smell occurred to me. ...
# July 21, 2005 8:10 AM

Jeremy D. Miller -- The Shade Tree Developer said:

As some of you know, I started a new job this month as a consultant helping clients to adopt Agile practices.

# October 30, 2006 10:49 PM

Paul Holser said:

Nice post.  "Ghostbusters" is the movie, IIRC?

# November 20, 2006 12:29 PM

Jeremy D. Miller said:

Star Wars!  When they're trying to escape the Death Star detention area and they go down the trash shute

# November 20, 2006 12:50 PM

Paul Holser said:

Aaargghh!  I hereby turn in my Official Geek Badge and Decoder Ring.  8^(

# January 5, 2007 12:44 PM

Julien Crawford said:

I like the code-smell concept its a good one.

The reason you (and I) though Ghostbusters was because of Dan Acroids : "Quite, do you smell something?" comment.

# May 21, 2007 1:24 AM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add

About Jeremy D. Miller

Jeremy began his IT career writing "Shadow IT" applications to automate his engineering documentation, then wandered into software development because it looked like more fun. Jeremy previously worked as a systems architect building mission critical supply chain software for a Fortune 100 company and learned agile development practices as a .Net consultant at ThoughtWorks, one of the pioneers of agile development. Jeremy is the author of the open source StructureMap (http://structuremap.sourceforge.net) tool for Dependency Injection with .Net and the forthcoming StoryTeller (http://storyteller.tigris.org) tool for supercharged FIT testing in .Net. Jeremy's thoughts on just about everything software related can be found on his weblog "The Shade Tree Developer" at http://codebetter.com/blogs/jeremy.miller, part of the popular CodeBetter site. Jeremy is a Microsoft MVP for C#. Check out Devlicio.us!

Our Sponsors

This Blog

Syndication

News

All opinions expressed here constitute my (Jeremy D. Miller's) personal opinion, and do not necessarily represent the opinion of any other organization or person, including (but not limited to) my fellow employees, my employer, its clients or their agents.

About Me

"Best Of" Compendium

StructureMap (Dependency Injection for .Net)

StoryTeller (Supercharged Fit)

Build your own Cab

TestDriven

MVP