Worst Abstraction Inversion

What is the worst (due to either prevalence or severity) example of abstraction inversion that you see in programming today?

For those of you who are not familiar with the concept, abstraction inversion is implementing low-level constructs on top of high-level constructs. More precisely, assume you have constructs A and B. B is implemented on top of A, but A is not exposed anywhere. Therefore, if you really need the lower level construct A, you end up implementing A on top of B, when B is implemented in terms of A in the first place. See http://en.wikipedia.org/wiki/Abstraction_inversion.

Answers


Probably the worst example of abstraction abuse I've ever seen was this fluent C#, which wrapped basic flow control elements (if, whiles, sequenced expressions) in a fluent interface.

So your perfectly idiomatic, clean code:

var selectedTextBox = (TextBox)sender,
if (IsAdmin)
{
    selectedTextBox.Enabled = true;
    selectedTextBox.Text = superSecretPassword;
}
else
{ 
    selectedTextBox.Clear();
}

Becomes this mess:

Cast<TextBox>(sender).
    WithIf(IsAdmin,
        With(selectedTextBox => selectedTextBox.Enabled = true).
        With(selectedTextBox => selectedTextBox.Text = superSecretPassword),
        With(selectedTextBox => selectedTextBox.Clear());

Because everything's better with lambdas!


Need Your Help

Multiple dex files - Conversion to Dalvik format failed - Unable to execute dex

java android dalvik dex

I have 2 app versions - pro and lite. They are both already on the market at v1.01. I am trying to release v1.1 for both. This update includes SwawrmConnect integration in order to use their glo...

Data Mappers calling each other in Domain Driven Design pattern

design-patterns domain-driven-design datamapper

In my project I am using a Domain Driven Design Pattern. I have various data mappers that I use for persisting my model objects. Some of my models contain other models as attributes (e.g., model cl...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.