If you’re a developer and you haven’t read this post, The Mythical Business Layer, on The Daily WTF, please drop what you’re doing and go read it. I have it in my starred items in Google Reader because it’s vital to me to be able to explain insanity to my boss when he starts getting notions that resemble the ERE.
Concepts like this one from the article make perfect sense to me, but I don’t explain it as well as Alex does.
I’ll bet some of you, without even seeing the rest of specs, excitedly envisioned a CancelationWorkflowProvider that inherited from the abstract RequestWorkflowProvider and implemented the IPermissionRequired, IPropogationStatusRequired, and IExpenseAllocationTypeRequired interfaces, and was powered by the all-encompassing WorkflowManager. Why? Because that’s so much more challenging than writing a simple IF-ELSE code block.
I personally am a huge believer in KISS. I read the specs and indeed DID see IF-ELSE blocks. Call me boring. I prefer to not overcomplicate things. I code as much as needed, but no more, to achieve the desired result in a way that is easy to maintain. If it needs extensions later, great! We can do that. But to code a behemoth for the sake of principle is, in my opinion, idiotic.
Code, by its nature, is fluid. Specs change. Applications evolve. Refactoring should be a part of a program’s life cycle. Don’t fear change. Sure, you want to soft code some things that change depending on where the application is installed, such as settings. Business logic, however, should be hard-coded. Sure, you want to have code re-use with functions/methods, but you don’t need them so generic that they no longer have a real purpose. Your platform of choice likely already has generic functions to do things like format strings, convert dates, and whatnot. Don’t waste your valuable time reinventing the wheel.
I blame a lot of the crap I see these passed off as code these days on the fact that new developers are shoved directly into OOP instead of being taught programming from the ground up. If you’re never taught procedural code, you try to make everything an object, a factory, a pattern, or a method. You try to create abstractions where none are needed.
Too many developers are, as Alex says, using a hammer to create something that can pound in nails. Stop that, kids. If you’re bored, go learn a new language instead of abusing the one you’re using.