Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Jenn Creighton
Jenn Creighton

Posted on • Edited on

     

The Antipattern Antipattern

One common antipattern in software engineering is the Antipattern Antipattern:

Thinking that the term "antipattern" means "never use this pattern."

"An antipattern is just like a pattern, except that instead of a solution it gives something that looks superficially like a solution, but isn't one."
Andrew Koenig, Journal of Object-Oriented Programming, April 1995

Antipatterns are disguised as good solutions. The danger is when the pattern is applied without evaluating the alternatives. Antipatterns become antipatterns when:

The patterns results in unintended and undesired outcomesand another pattern exists that is a repeatable and effective solution.

That means thatantipatterns are context-dependent. Antipatterns can be the best solution when other patternsdo not exist or arenot effective solutions. The context of the problem you want to solveand the system you are working in can change an antipattern into a pattern.

So, what's the fix to the Antipattern Antipattern?

Understanding that more often than not the antipattern willnot be the solution you want. Butif the evaluated alternatives arenot effective, the antipattern can be used with the knowledge of the potential desired and undesired outcomes.

Top comments(5)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
dwilmer profile image
Daan Wilmer
  • Joined

Looking at the list of anti-patterns on Wikipedia, the best candidate for being an antipattern antipattern would be copy-paste programming. There is value in copy-paste programming, depending on context. One case would be in an early version of your software, where you would first copy-paste some things to get your code running and then try to abstract where beneficial.

Another case is something that was mentioned in a lecture I attended 6 or 7 years ago, so I don't remember the details. There is a lot of code duplication in some of the Linux drivers, and I think it was the graphics drivers. IIRC, the drivers are responsible for a lot of configuration, which is of course very similar between similar graphics cards. Of course there is a lot of code shared and abstracted away, but there was still a lot of copy-pasting of code. And, for this particular use case, it was the best implementation (or at least a local optimum).

CollapseExpand
 
ben profile image
Ben Halpern
A Canadian software developer who thinks he’s funny.
  • Email
  • Location
    NY
  • Education
    Mount Allison University
  • Pronouns
    He/him
  • Work
    Co-founder at Forem
  • Joined

I love this game.

React is an example of a technology which was a HUGE antipattern for web developers and eventually it became what everyone was doing... until the next antipattern buster.

Not that one is wrong for thinking of something as an antipattern, but it’s often used to end conversations instead of starting them. Clean code follows many patterns, and if things are done with care I don’t think anything is an antipattern in and of itself.

CollapseExpand
 
_hs_ profile image
HS
software developer doing some architecture
  • Location
    Göteborg, Sweden
  • Work
    Software developer
  • Joined

The antipattern should mean using pattern the way it was not intended to therefor making an extra complexity problem instead of having a common solution to a common problem. Anything more than that will lead to philosophy as in functional programming and object oriented programming where, after given amount of time developers would discuss it as possible good practice.

CollapseExpand
 
jjjimenez100 profile image
Joshua Jimenez

Would have been better if you provided a concrete example / situation with this one to strengthen and support your points.

CollapseExpand
 
thorstenhirsch profile image
Thorsten Hirsch
  • Joined

Do you have an example for an antipattern that you used when you found no othereffective solution?

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Senior Software Engineer @netflix, host @single_threaded podcast, organizer #WomenOfReact2020 / @useReactNYC
  • Location
    New York, NY
  • Work
    Senior Software Engineer
  • Joined

Trending onDEV CommunityHot

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp