Friday, November 26, 2010

Keeping it stupidly simple

Oh, why is it so difficult to keep something stupidly simple?
Well, probably The Law of Leaky Abtractions has an important part of it. Or better thought, a misunderstanding of it. The most basic premise of the law is: "All non-trivial abstractions, to some degree, are leaky."
Which relation does it have with not keeping it simple? Well, the problem, IMHO, is that many people are trying to prevent the abstraction leaks from occurring. And that usually leads to an over-engineered mess, no kidding!
What should be done about these leaks? Nothing more than acknowledging them! If abstractions are good 98% of the time and bring problems on 2% of cases (real world problems could be much lower if the abstraction is good enough), acknowledging these leaks should be enough. What happens if you need the special case where the abstraction leaks? you go to a lower level and don't use the abstraction for the concrete problematic case. Period. (Well, sometimes something sinply stupid can be added to the abstraction, and if it's simple enough it should be done).
The moment you start adding complexity to the abstraction to solve one of its leaks, you are ruining it. Even if the complexity added is really low, you are adding it always, thus degrading the usage in practically all cases, just to improve some exceptional ones...
And as the abstraction will always be leaky, new exceptions will continue appearing, thus degrading the experience further and further, until you end with some monstrosity (and I'm thinking on a particular framework) where the complexity inherent to the abstraction is so high that it ends being much more difficult to use it "correctly" (pun intended) that to bypass it completely and doing all the work "the old way".

No comments:

Post a Comment