AntiPattern Name: TowerOfVoodoo
Type: Development
Problem: Well-designed interfaces can end up buried in the basement of a tower; each floor of the tower is a badly-written wrapping layer that seems to be the result of VoodooChickenCoding. The resulting application is inefficient and poorly-understood.
Context: Developers often have to use interfaces that are new to them. They know what they want to get done, and just want to achieve that goal and then move on.
Forces:
Resulting Context: The good thing is that the job is done. The bad thing is that the original interface is now hidden behind a new one which may be lacking in at least two ways: understanding of the relevant problem domain, and understanding of the details of the original interface. For both these reasons, the next developer coming along may well find it doesn't fit their needs. So they do exactly the same thing on top of the first wrapper. And then the next developer comes along. And then the next. And the next...
Rationale: "I'm simply adapting the interface to the needs of my application layer."
Better Solutions: Don't wrap stuff unless you have a good reason. And if an existing wrapper doesn't meet your needs, try to change it rather than covering it in a new layer of abstraction.
Related AntiPatterns: VoodooChickenCoding, NotInventedHere
Examples: The following things often seem to be (badly) wrapped for no good reason:
Examples in Practice:
This one was sparked off by a conversation with a friend, where we realised that we had both seen a lot of code that had as many as 6 layers of wrapping around perfectly good and usable APIs: where the need for any wrapping at all was unclear.
Might this sometimes be the fault of bad-documentation or even design of the underlying API? If it isn't, sort of, self-evident, then I'm going to stick with the first thing that seems to work.