Anti-pattern
From Wikipedia, the free encyclopedia
Anti-patterns, also referred to as pitfalls, are classes of commonly-reinvented bad solutions to problems. They are studied, as a category, in order that they may be avoided in the future, and that instances of them may be recognized when investigating non-working systems.
The term originates in computer science, apparently inspired by the Gang of Four's Design Patterns book, which laid out examples of good programming practice. The authors termed these good methods "design patterns", by analogy with the term as used in architecture. "Anti-patterns", as described in the book by Brown, Malveau, McCormick and Mowbray, are a natural counterpart, though not mentioned in the original Design Patterns book. Part of good programming practice is the avoidance of anti-patterns.
The concept is readily applied to engineering in general, and also applies outside engineering, in any human endeavour. Although the term is not commonly used outside engineering, the concept is quite universal.
- See also: Design pattern (computer science)
Contents |
[edit] Some recognized software development anti-patterns
- For a more comprehensive, alphabetical list, see Category:Anti-patterns.
[edit] Project management anti-patterns
- Smoke and mirrors: Demonstrating how unimplemented functions will appear
- Software bloat: Allowing successive versions of a system to demand ever more resources
- Bad Management: Managing a project without being sufficiently knowledgeable in the subject
[edit] General design anti-patterns
- Abstraction inversion: Not exposing functionality required by users, so that they re-implement it using higher level functions
- Ambiguous viewpoint: Presenting a model (usually OOAD) without specifying its viewpoint
- Big ball of mud: A system with no recognisable structure
- Blob: see God object
- Gas factory: An unnecessarily complex design
- Input kludge: Failing to specify and implement handling of possibly invalid input
- Interface bloat: Making an interface so powerful that it is too hard to implement
- Magic pushbutton: Implementing the results of user actions in terms of an inappropriate (insufficiently abstract) interface
- Re-Coupling: Introducing unnecessary object dependency
- Stovepipe system: A barely maintainable assemblage of ill-related components
- Race hazard: Failing to see the consequence of different orders of events
- Database as an IPC: Using a database to communicate between processes on one or several computers when direct IPC is more appropriate.
[edit] Object-oriented design anti-patterns
- BaseBean: Inheriting functionality from a utility class rather than delegating to it
- CallSuper: Requiring subclasses to call a superclass's overridden method
- Empty subclass failure: Creating a (Perl) class that fails the "Empty Subclass Test" by behaving differently from a class derived from it without modifications
- God object: Concentrating too many functions in a single part of the design (class)
- Object cesspool: Reusing objects whose state does not conform to the (possibly implicit) contract for re-use
- Poltergeists: Objects whose sole purpose is to pass information to another object
- Yo-yo problem: A structure (e.g. of inheritance) that is hard to understand due to excessive fragmentation
- Anemic Domain Model: The use of domain model without any business logic which is not OO because each object should have both attributes and behaviors
- Sequential Coupling: A class that requires its methods to be called in a particular order
- Singletonitis: The overuse of the singleton pattern
- YAFL (Yet Another Layer): Adding unnecessary layers to a program, library or framework. This became popular after the first book on programming patterns.
[edit] Programming anti-patterns
- Accidental complexity: Introducing unnecessary complexity into a solution
- Action at a distance: Unexpected interaction between widely separated parts of a system
- Accumulate and fire: Setting parameters for subroutines in a collection of global variables
- 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
- 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
- Checking type instead of interface: Checking that an object has a specific type when only a certain contract is required
- 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 recognised
- Double-checked locking: Checking, before locking, if this is necessary in a way which may fail with e.g. modern hardware or compilers
- 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: 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
- Magic numbers: Including unexplained numbers in algorithms
- Magic strings: Including literal strings in code, for comparisons, as event types etc.
- Packratting: Consuming excess memory by keeping dynamically allocated objects alive for longer than they are needed
- Spaghetti code: Systems whose structure is barely comprehensible, especially because of misuse of code structures
- Superboolean logic: unnecessary comparison or abstraction of boolean arithmetic
- Ravioli code: Systems with lots of objects that are loosely connected
- Loop-switch sequence: Encoding a set of sequential steps using a loop over a switch statement
[edit] Methodological anti-patterns
- Copy and paste programming: Copying (and modifying) existing code rather than creating generic solutions
- Programming by permutation: Trying to approach a solution by successively modifying the code to see if it works
- De-factoring: The process of removing functionality and replacing it with documentation
- Golden hammer: Assuming that a favorite solution is universally applicable
- Silver bullet: Assuming that a favorite technical solution can solve a larger process or problem
- Improbability factor: Assuming that it is improbable that a known error becomes effective
- Premature optimization: Optimization on the basis of insufficient information
- Reinventing the wheel: Failing to adopt an existing, adequate solution
- Reinventing the square wheel: Creating a poor solution when a good one exists
- Tester Driven Development: Software projects where new requirements are specified in bug reports
[edit] Configuration management anti-patterns
- Dependency hell: Problems with versions of required products, specifically on UNIX/Linux
- DLL hell: Problems with versions, availability and multiplication of DLLs, specifically on Microsoft Windows
- JAR hell: Problems with different versions or locations of JAR files, usually caused by a lack of understanding of the Classloading model
- Extension conflict: Problems with different extensions to Mac OS attempting to patch the same parts of the operating system
[edit] Some organisational 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
- Continuous obsolescence: Devoting disproportionate effort to porting a system to new environments
- Cost migration: Transfer of project expenses to a vulnerable department or business partner
- Creeping featurism: Adding new features to the detriment of the quality of a system
- 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
- I told you so: When the ignored warning of an expert proves justified, and this becomes the focus of attention
- Management by numbers: Paying excessive attention to quantitative management criteria, when these are non-essential or cost too much to acquire
- Management by perkele: Army-style management with no tolerance for dissent
- Moral hazard: Insulating a decision-maker from the consequences of her decision.
- Mushroom management: Keeping employees uninformed and abused (kept in the dark and fed on manure)
- Scope creep: Allowing the scope of a project to grow without proper control
- Stovepipe: An organisation structure that supports mostly up-down flow of data but inhibits cross organisational 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
[edit] See also
[edit] References
- Perl Design Patterns – A free online book
- Brown, William J., Raphael C. Malveau, Hays W. McCormick III, and Thomas J. Mowbray (1998). AntiPatterns: Refactoring Software, Architectures, and Projects in Crisis. John Wiley & Sons. ISBN 0-471-19713-0.
- Laplante, Phillip A., and Colin J. Neill (2005). AntiPatterns: Identification, Refactoring and Management. Auerbach Publications. ISBN 0-8493-2994-9.