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.

About Jeremy Miller

Jeremy is the Chief Software Architect at Dovetail Software, the coolest ISV in Austin. 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 is the author of the open source StructureMap tool for Dependency Injection with .Net, StoryTeller for supercharged acceptance testing in .Net, and one of the principal developers behind FubuMVC. Jeremy's thoughts on all things software can be found at The Shade Tree Developer at http://codebetter.com/jeremymiller.
This entry was posted in Ranting. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • Duncan

    Incredible

  • Julien Crawford

    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.

  • Paul Holser

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

  • http://codebetter.com/blogs/jeremy.miller jmiller

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

  • http://cleveralias.blogs.com Paul Holser

    Nice post. “Ghostbusters” is the movie, IIRC?

  • http://www.codebetter.com/blogs/raymond.lewallen Raymond Lewallen

    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.