Derek Neighbors

The more I learn, the less I know.

Personal Code Smells - How To Prevent Nose Blindness In Your Code

By Derek Neighbors, Published on December 8, 2022

Let’s talk about code smells for a minute. When you think about smell and you think about odor, you tend to think about bad smells. Something only smells bad if it’s different or there’s something wrong with it. What I mean by that is that if you are constantly in a space or a place that has something wrong with it or smells bad, you become immune to that smell. You get olfactory fatigue/adaptation. Let’s call it “nose blindness”.

Therefore, it doesn’t smell bad to you anymore, but somebody new coming in is gonna say, “Oh my goodness. It really stinks in here.” So, if we are all at the gym working out. We’re getting all sweaty. We start to smell. We all smell. That smell built up slowly with us all together. We don’t really notice that smell. It just creeped up over time.

Then, we go out to to eat or something right afterwards. People give us dirty looks because we stink. Same thing is true if you have a dog or a cat. It’s got some odor to it. Over time you get accustomed of those smells.

Then when somebody else comes to your house, they notice the smell instantly. Code does the same thing. It slowly decays. So the smells slowly emanate from it, but if you are in the code all the time, you don’t necessarily smell that because you’re in it all the time. So you become nose blind to it.

I think one of the best things you can do as a leader of engineers is teach people what good smell looks like. Give them good old Tide Pod. Give themem a good old whiff of what good smells like. Get the Febreze out. Let them understand what good clean odor is like.

Let them smell a fresh cut lawn. Let let them smell things that are delicious. Get that to be the standard so that any little tiny stink just drives you crazy. It’s just repulsive. If you want to deal with code smells, you have to have teh good smells ingrained in your brain so that you just have no tolerance for bad smells anymore.