views:

315

answers:

6

Has using an acknowledged anti-pattern ever been proven to actually work in a certain specific case? Did you ever solve a problem or gain any kind of benefit in one of your projects by using an anti-pattern?

+8  A: 

My understanding of the "anti-pattern" concept is that it encompasses solutions that have drawbacks that only reveal themselves over the long term. Indeed, the primary danger associated with a lot of them---like writing spaghetti code with loads of global variables and gotos every which way, or tossing exceptions into the black hole of an empty catch block---is that they're seductive because they provide an expedient solution to an immediate problem.

EDIT to add: Because of that, sometimes you do derive benefit from these anti-patterns. Sometimes your calculation that you're writing throwaway code that no one will touch again is dead wrong and you wind up with maintenance programmers slandering your heritage and sexual hygiene, but other times you're right and that crummy shell script that's held together with baling wire and spit does the job you intended it to do and is then blessedly forgotten, saving you the considerable time and effort of putting together something decent.

Pillsy
+2  A: 

The biggest problem that it has solved in my experience is launching a new application.

When the dev team has scoped the new application thouroughly, the timeline to implement the correct solution is usually too much for management to bear. Therefore, oftentimes, you code to meet the timeline, rather than "correctness" of the solution to get to the launch date, (but have others coding the "correct" solution for the next rev), making it essentially "throw-away" code.

GalacticJello
+5  A: 

Anti-Patterns are still so widely around just because they solve a particular problem (while creating 10 new ones). Also known as workaround. But how do they say? Nothing lasts longer than a makeshift.

In fact I believe we'd all be jobless if things had been done right from the beginning.

herzmeister der welten
+1  A: 

One software anti-pattern is Softcoding, also defined at the daily WTF. Softcoding happens when programmers put material that "should be" inside code into external resources.

I'm working with software that some might say is suffering from softcoding. External files drive the software. Those external files are a micro-language: they must be compiled to XML before the software can use them. This micro-language has its own tools.

But softcoding is always in the mind of the beholder.

Having the material in a micro-language with its own parser has made my life easier. One data source can generate many different outputs: In addition to the version that the main program uses, I am able to extract information into HTML, .csv, and other formats that our customers want. Other programs can generate code in the micro-language, making automation easier.

In our case, softcoding has been a useful pattern, not an anti-pattern.

Chip Uni
I don't think that what you're describing is is an example of softcode. I was developing similar sofware, that was loading it's logic from some custom language and it we also found it very useful.I was considering our application as a interpreter language, like shell - your application just executes script written in micro-language language.Softcode talks more about descrete values and not about logic outside application.
dimba
This sounds like data driven programming or a DSL, generally acknowledged as good things.
kotlinski
A: 

There is a reason for calling it a pattern rather than a law.

I would surmise that almost everyone has at least one example of a place in code where exactly the wrong thing was done, and it turned out better in the long term than the "right" thing would have.

And a far longer list of examples of anti-patterns causing trouble.

I have used magic pushbuttons a number of times, out of ignorance or laziness, and sometimes it actually worked out just fine, and it turned out that I did not need the extra abstraction of proper MVC.

Justin Smith
A: 

Duff's Device utilizes the Loop-Switch Sequence (AKA For-Case Paradigm) anti-pattern.

Aaronaught