Smell#: the tool to detect Code Smells

I’ve been doing a lot of reading about how to fight code smells and how to write more cohesive code. One of the tools that I use to help me finding out code smells is DevExpress‘ Metrics window (it comes with RefactorPro, but I know they also provide that plug-in for free).

aa

I always have that window open in VS, and as I work through source code I can "see" the smell whenever I notice the graph bars going into the yellow or red areas.

Inspired by the modern amusement parks, I’ve been thinking about developing a device to push that experience even further. You know when we go to those movie theaters where they try to make you really get into the movie, and they do so by spraying water on you and things like that?

So, I’m thinking about creating this device that one attaches to the computer, and as the developer "walks" into smelly code, a bad smell pours out of the device, right into the developer’s face. Wouldn’t that be a nice 3-D experience? Of course we could also have the device sprays some nice fragrance in case the code smells right.  🙂

I’m thinking about naming this device as Smell# (pronounced Smell Sharp):

aa[7]

Imagine people getting used to the other developers’ bad smell: "Hey, I’m pretty sure Joe has been here… this code smells bad just like him", or "look, this can only be Tina’s code; I could smell that perfume from miles away!".

Of course, some people would get really upset about having to feel somebody else’s bad smell. However, this should eventually help with pushing everybody into taking care of their smells. Nobody would like to go into a meeting with other developers and hear something like "hey dude, what have you been eating? Nobody can stand you smell… everybody avoids your code just like we’re avoiding a plague…".

Ok, that’s the idea. I haven’t put a patent on it yet, so if you decide to go ahead and build this, please make sure mail me the checks. Thanks.  🙂

All joking aside, I remember working on this project years ago where I was maintaining somebody else’s code. The guy used to use to name his variables after bad words. Oh boy, you could find some real nasty variable names in there. Imagine the user getting an error message that reads something like "Penis not found" (I’m keep it mild so to not get this post categorized as PG-13 or something…).

I mean, the days when developers would use some cryptic names for variables, methods, properties, classes, etc., are (or should be) long gone. Applications are not a black box anymore, where the end-users wouldn’t ever see the underlying code for it. Nowadays, programming is much less of a black art, and most of the time the customer you’re building an application for will be looking at your code, so you better write it as professionally as you can. No bad words, no in-house funny remarks, nothing like that is allowed.

I feel like this is a topic I’ll be posting more about it, just because I’ve been feeling really strong about it.

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: