Kitchen Cupboard Anti-pattern

Recently, I have come across an anti-pattern that all of us has seen from time to time. After some discussion with my coworker Uri, I decided to call it the Kitchen Cupboard Anti-pattern.

The pattern takes its name from a situation we’ve all experienced: you want to store something in a jam-packed kitchen cupboard, so you open it up, and your Rice Krispies, peanut-butter, coffee, and marmalade falls out. For a short moment you ponder whether to rearrange the cupboard, so that everything would fit more nicely, but after three seconds you decide to wedge everything in there, and quickly close the door. You silently hope that someone else will open the door next time, and that he (or probably she) will clean the cupboard up.

The Anti-pattern is quite similar: you were told to fix an application you know nothing about, so you decide to browse through the source code. It is even worse than you expected: code was copied from place to place, there are 1000+ classes; all suitable for the Daily WTF, hardly any documentation; the documentation that does exists hasn’t been updated in years, and half of the unit tests fail. You ponder whether to refactor the app, or at least the part you’re supposed to fix. But after three seconds, you decide to wedge your code in there, run the unit tests (for the part of the application you touched anyway), and commit. You silently hope that someone else will be put on the project next, and that she (or probably he) will refactor the project.

2 Comments

  1. Anonymous said,

    August 23, 2005 @ 15:24

    I think patterns (and therefor anti-patterns) are supposed to describe something specific. So when two people are talking, instead of describing a complex process, they can shortcut it by saying “It implements the Command Pattern”. That way, you know the system generally behaves the way we all agree Command Pattern behaves.

    The “kitchen cupboard” pattern can be just about anything at all (including just not being able to understand something that DOES work well).

    I’m not saying that what you are describing isn’t valid, I just don’t think it’s really a pattern.

  2. American Coward said,

    August 24, 2005 @ 8:51

    I’m not sure but this looks as valid to me. Chain of Responsibility and Bridge are also common patterns, ambiguous in definition.

    Anyway, what is certain is that this is more of an antipattern than else. Just like GoldenHammer, or GuruDoesAll. And I like the name, it certainly is more sticky than the “if it isn’t broke, don’t fix it” principle.

RSS feed for comments on this post