Abstraction isn't free
It costs a buck o' five.
Eric Gunnerson explains the #1 Deadly Sin of Programming, which is premature generalization, also know as the Turing Tar Pit. He uses the real life example of an overly complex and generalized GUI layout manager:
At that point, you often have to think about abandoning the code and redeveloping in the next version. And in the next cycle, this group *did* learn from their mistakes - instead of the uber-component, they built a small and simple library that different scenarios could use effectively. And it turned out that, overall, they wrote less code than before.
HaHA. I make joke.
What they really did was build *another* uber-component that looked really promising early (they always do), but ultimately was more complex than the last version and traded a new set of problems for the old ones. But, building it was a technical challenge for the developers involved, and that's what's really important...
As someone who's done his fair share of both over-engineering and under-engineering software, I must say that over-engineering seems just as bad as (and maybe worse than) under-engineering.
What is over engineering? Basically it's when engineering "best practices" are applied to the detriment of the project. In the above case of the layout manager, it's the "best practice" of software abstraction and reuse.
Like under-engineering, there are long term costs associated with over-engineering that continue to slow productivity, but unlike under-engineered code, over-engineered code is less likely to be addressed. Lots of work goes into over-engineering things, so it must be more valuable. And because the code is harder to understand, the impact of changing the code is harder to gauge. And so it lives on, frustrating developers for years to come who ask themselves "Why is this so hard?".
So how to know when you are over-engineering things? I struggle with that all the time, and there are no easy answers. Which leads to the point that there really are no best practices.
Posted August 4, 2006 3:52 PM