I apologize in advance for the poor taste displayed by this post, but it was a rough day.
Harry Pierson’s post on Sacred Code Cows made me feel a little a bit guilty. I’ve completely shaken off the bonds of Hungarian Notation, except for the silly ISomething convention for interfaces that is so prevalent in the .Net world. I can’t abide CSomething, and I certainly can’t stand the old m_strSomething nonsense from VB6 coding. We tried to stop using the “I” prefix on a .Net project a couple years ago, but it just confused people who expected the interfaces to start with an “I.”
The “I” prefix has been much harder to eliminate, but the slavish adherence to an outdated idea about coding conventions got me in some trouble. At the Austin Code Camp last month I did a talk on Code Smells. Of course I had to do the obligatory refactoring from a repeated switch statement to a strategy pattern. I appropriated and adapted a sample of this refactoring based on the famous “Coconut-laden swallow” bit from Monty Python and the Holy Grail. So as everybody who’s seen the movie (it’s an absolute necessity for understanding the culture of the typical software development shop) knows, the European swallows have different payload and wing speed capabilities than African swallows. In my Code Camp sample I refactored a pair of switch statements on the type code of swallow to a series of strategy classes that all implemented a common interface. Of course, you can probably guess what I called the interface for types of swallow.
And yes, I had a Ron Burgundy moment.