Tag Archives: Anti-pattern

Anti-pattern and Smell: Synonyms or Nodding Acquaintances?

Published by:

Andrew Koenig coined the term “anti-pattern” in his paper titled “Patterns and antipatterns” [1] way back in 1995. Unfortunately, I could not retrieve the paper from the Internet (If you can, please send me a copy). Later, a book by the upstart gang of four titled “AntiPatterns: Refactoring Software, Architectures, and Projects in Crisis” presented various anti-patterns and smells belonging to technical as well as management domain.

Today, software engineering researchers and practitioners often use the terms “anti-pattern” and “smell” interchangeably. However, they are conceptually not the same. The Wikipedia entry of anti-pattern [2] states that an anti-pattern is different from a bad practice or a bad idea by at least two factors. An anti-pattern is “A commonly used process, structure or pattern of action that despite initially appearing to be an appropriate and effective response to a problem, typically has more bad consequences than beneficial results.” It clearly indicates that an anti-pattern is chosen in the belief that it is a good solution (as a pattern) to the presented problem; however, it brings more liabilities than benefits. Martin Fowler also has expressed similar thoughts in a blog post [3].

On the other hand, a smell is simply a bad practice that negatively affects the quality of a software system. For example, Singleton is an anti-pattern and God class (or Insufficient Modularization, as we call it in our book) is a design smell.

Anti-patterns are chosen but smells occur (unknowingly and unintentionally). In addition, a misapplied pattern becomes an anti-pattern in a given context. And yes, an anti-pattern may lead to one or more smells.

antipattern

Another interesting aspect to ponder about is the impact of anti-patterns and smells. The impact and severity of an anti-pattern are high from the outset while the severity of a smell grows slowly. Along the same lines, it is relatively easier to refactor an anti-pattern than a smell especially when a long time has been passed since the introduction of the anti-pattern or the smell.

  1. Andrew Koenig. 1998. Patterns and antipatterns. In The patterns handbooks, Linda Rising (Ed.). Cambridge University Press, New York, NY, USA 383-389.
  2. Wikipedia – Anti-pattern. Available at – https://en.wikipedia.org/wiki/Anti-pattern. [Last accessed on Feb 18th, 2016]
  3. Martin Fowler. Antipattern. Available at – http://martinfowler.com/bliki/AntiPattern.html. [Last accessed on Feb 18th, 2016]