How do you hide bad code smells?

Ever come across some code that just wreaks?

I’m talking the kind of smells like 500 line method implementations or methods that are located in the wrong class.

It’s amusing to see how developers go out of their way to hide their problems rather than fix them.

There are two code-smell hiding techniques I often see utilized in the C# Visual Studio space.

  1. Wrap the offending code in a #region (and hope that others don’t have region expansion on by default)
  2. Move the distracting/inappropriately placed members into a partial class

Most often though I find that developers seem proud of the smells as they don’t even bother to hide the fact that they’ve just left a big stinky guff for the next person to walk right into.

What code-smell hiding techniques have you been witness to? Or more importantly how do you hide your own smells?

Posted in .Net, C#, Development by Ben at November 26th, 2008.

One Response to “How do you hide bad code smells?”

  1. Andrew says:

    One word….. façade pattern (ok, smarty-pants, that’s two words). Its the deoderant of programming.

Leave a Reply