DEV Community

Cover image for Anti-Pattern
Senthil Nayagan
Senthil Nayagan

Posted on

Anti-Pattern

What is an anti-pattern?

The term "anti-pattern" was first used in 1995 by a computer programmer, Andrew Koenig, in an article called "Journal of Object-Oriented Programming."

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

Anti-patterns in software engineering are a commonly used, simple-to-implement solution to recurring issues that is often inefficient and has the potential of being incredibly counterproductive. It demonstrates how to go from a problem to a bad solution. We just call these bad ideas.

It's important to keep in mind that identifying bad practices can be as valuable as identifying good practices.

Although they first seem to be quick and reasonable, anti-patterns typically have adverse effects in the future. We will eventually come to understand that anti-pattern results in more negative outcomes than positive ones.

A well formulated anti-pattern reveals us:

  • Why does the poor solution seem appealing?
  • Why it ends up being bad?
  • What best patterns are available to replace it?

The issue that the anti-pattern is attempting to solve already has a better alternative solution in place that is proven to be effective in contrast to the anti-pattern.

Keep in mind that the same solution act as both a pattern and an anti-pattern depending on the situation.

Top comments (0)