Anti-pattern

Wikipedia, the free encyclopedia - Cite This Source

In software engineering, an anti-pattern (or antipattern) is a design pattern that appears obvious but is ineffective or far from optimal in practice.

The term was coined in 1995 by Andrew Koenig, inspired by Gang of Four's book Design Patterns, which developed the concept of design patterns in the software field. The term was widely popularized three years later by the book AntiPatterns, which extended the use of the term beyond the field of software design and into general social interaction. According to the authors of the latter, there must be at least two key elements present to formally distinguish an actual anti-pattern from a simple bad habit, bad practice, or bad idea:

  • Some repeated pattern of action, process or structure that initially appears to be beneficial, but ultimately produces more bad consequences than beneficial results, and
  • A refactored solution that is clearly documented, proven in actual practice and repeatable.

Often pejoratively named with clever oxymoronic neologisms, many anti-pattern ideas amount to little more than mistakes, rants, unsolvable problems, or bad practices to be avoided if possible. Sometimes called pitfalls or dark patterns, this informal use of the term has come to refer to classes of commonly reinvented bad solutions to problems. Thus, many candidate anti-patterns under debate would not be formally considered anti-patterns.

By formally describing repeated mistakes, one can recognize the forces that lead to their repetition and learn how others have refactored themselves out of these broken patterns.

Known anti-patterns

Organizational anti-patterns

  • Analysis paralysis: Devoting disproportionate effort to the analysis phase of a project
  • Cash cow: A profitable legacy product that often leads to complacency about new products
  • Cost migration: Transfer of project expenses to a vulnerable department or business partner
  • Crisis mode (a.k.a firefighting mode): Dealing with things only when they become a crisis, with the result that everything becomes a crisis
  • Design by committee: The result of having many contributors to a design, but no unifying vision
  • Escalation of commitment: Failing to revoke a decision when it proves wrong
  • Management by neglect: Too much delegation
  • Management by numbers: Paying excessive attention to quantitative management criteria, when these are non-essential or cost too much to acquire
  • Management by perkele: Authoritarian style of management with no tolerance for dissent
  • Management by wondering: Expecting a team to define their own objectives, and then wondering what they're doing
  • Milk Monitor Promotion: A pseudo promotion (a better sounding title), with no additional responsibilities or pay increase, which is given as a quick and costless way to make the employee work harder.
  • Moral hazard: Insulating a decision-maker from the consequences of his or her decision.
  • Mushroom management: Keeping employees uninformed and misinformed (kept in the dark and fed manure)
  • Stovepipe: A structure that supports mostly up-down flow of data but inhibits cross organizational communication
  • Vendor lock-in: Making a system excessively dependent on an externally supplied component
  • Violin string organization: A highly tuned and trimmed organization with no flexibility

Project management anti-patterns

  • Death march: Everyone knows that the project is going to be a disaster - except the CEO. However, the truth remains hidden and the project is artificially kept alive until the Day Zero finally comes ("Big Bang")
  • Smoke and mirrors: Demonstrating how unimplemented functions will appear
  • Software bloat: Allowing successive versions of a system to demand ever more resources

Analysis anti-patterns

  • Napkin specification: The Functional/Technical specification is given to the Development team on a napkin (i.e., informally, and with insufficient detail) which is fundamentally equivalent to having no specification at all.
  • Phony requirements: All requirements are communicated to the development teams in a rapid succession of netmeeting sessions or phone calls with no Functional/Technical specification or other supporting documentation.
  • Retro-specification: To write the Technical/Functional specification after the project has already gone live.

Software design anti-patterns

Object-oriented design anti-patterns

Programming anti-patterns

  • Accidental complexity: Introducing unnecessary complexity into a solution
  • Accumulate and fire: Setting parameters for subroutines in a collection of global variables
  • Action at a distance: Unexpected interaction between widely separated parts of a system
  • Blind faith: Lack of checking of (a) the correctness of a bug fix or (b) the result of a subroutine
  • Boat anchor: Retaining a part of a system that no longer has any use
  • Bug magnet: A block of code so infrequently invoked/tested that it will most likely fail, or any error-prone construct or practice.
  • Busy spin: Consuming CPU while waiting for something to happen, usually by repeated checking instead of proper messaging
  • Caching failure: Forgetting to reset an error flag when an error has been corrected
  • Cargo cult programming: Using patterns and methods without understanding why
  • Checking type instead of interface: Checking that an object has a specific type when only a certain contract is required. May cause Empty subclass failure.
  • Code momentum: Over-constraining part of a system by repeatedly assuming things about it in other parts
  • Coding by exception: Adding new code to handle each special case as it is recognized
  • Error hiding: Catching an error message before it can be shown to the user and either showing nothing or showing a meaningless message
  • Expection handling: (From Exception + Expect) Using a language's error handling system to implement normal program logic
  • Hard code: Embedding assumptions about the environment of a system at many points in its implementation
  • Lava flow: Retaining undesirable (redundant or low-quality) code because removing it is too expensive or has unpredictable consequences
  • Loop-switch sequence: Encoding a set of sequential steps using a loop over a switch statement
  • Magic numbers: Including unexplained numbers in algorithms
  • Magic strings: Including literal strings in code, for comparisons, as event types etc.
  • Monkey work: Term for any general repeated support code required within projects which suffer from poor code reuse and design. Is often avoided and rushed, hence open to errors and can quickly become a Bug magnet.
  • Packratting: Consuming excessive memory by keeping dynamically allocated objects alive for longer than they are needed
  • Parallel protectionism: When code becomes so complex and fragile that it is easier to clone a parallel infrastructure than to add a trivial attribute to existing infrastructure
  • Ravioli code: Systems with lots of objects that are loosely connected
  • Soft code: Storing business logic in configuration files rather than source code
  • Spaghetti code: Systems whose structure is barely comprehensible, especially because of misuse of code structures
  • Wrapping wool in cotton: Commonly observed when framework methods are contained in single line methods in wrapper classes which provide no useful abstraction

Methodological anti-patterns

Testing anti-patterns

  • Hostile testing: Antagonizing practical development solutions and workflow with over-testing procedures or over-scheduling test runs
  • Meta-testing: Overdesigning testing procedures until it is necessary to test them, also known as "watchmen's watchmen"
  • Moving target: Continuously change design and/or implementation in order to escape established testing procedures

Configuration management anti-patterns

See also

References

Further reading

  1. Laplante, Phillip A.; Colin J. Neill (2005). Antipatterns: Identification, Refactoring and Management. Auerbach Publications. ISBN 0-8493-2994-9.
  2. #

    External links

  3. Anti-pattern at WikiWikiWeb
  4. Anti-patterns catalog at WikiWikiWeb
  5. AntiPatterns.com Web site for the AntiPatterns book
  6. AntiPatterns Reference
  7. Patterns of Toxic Behavior



Wikipedia, the free encyclopedia © 2001-2006 Wikipedia contributors (Disclaimer)
This article is licensed under the GNU Free Documentation License.
Last updated on Monday July 21, 2008 at 21:41:25 PDT (GMT -0700)
View this article at Wikipedia.org - Edit this article at Wikipedia.org - Donate to the Wikimedia Foundation