Types of Anti-Patterns
About
Anti-patterns can be classified based on where they appear in software development from low-level code issues to large-scale architectural problems. Understanding their types helps identify problems early and guide effective refactoring.
1. Code-Level Anti-Patterns
These anti-patterns occur in the implementation of logic and syntax. They often result from rushed development, lack of refactoring, or misunderstanding of language features.
Magic Numbers/Strings
Using hardcoded values in code instead of named constants, making code difficult to understand or change.
Copy-Paste Programming
Repeating the same code across multiple places instead of reusing methods or abstractions.
Long Methods
Functions that do too much, reducing readability and reusability.
Commented-Out Code
Leaving large chunks of old code commented instead of removing it cleanly.
Excessive Logging
Filling code with unnecessary or verbose log statements, obscuring useful information.
2. Design Anti-Patterns
These are poor object-oriented design decisions that lead to tightly coupled, fragile systems and hinder extensibility.
God Object / Blob
A class that knows too much or does too many things, violating the Single Responsibility Principle.
Lava Flow
Code that’s outdated or redundant but remains in the system out of fear of breaking things.
Poltergeist
Short-lived, unnecessary objects (often created just to call another object).
Overuse of Inheritance
Relying on deep inheritance hierarchies instead of favoring composition.
Circular Dependencies
Classes or modules that directly or indirectly depend on each other, making code brittle and hard to maintain.
3. Architectural Anti-Patterns
These affect the high-level structure of systems and often emerge due to poor planning or lack of clear architectural vision.
Big Ball of Mud
A system with no discernible structure, where everything is interconnected and difficult to maintain.
Golden Hammer
Applying a familiar tool or pattern to every problem, regardless of its suitability.
Stovepipe System
Independent systems or modules with little to no integration or reuse.
Reinventing the Wheel
Creating custom solutions for problems already solved by mature libraries or tools.
Vendor Lock-in
Overdependence on a single vendor’s technologies, reducing flexibility and portability.
4. Concurrency Anti-Patterns
These appear in multi-threaded or asynchronous programming and can lead to serious performance or correctness issues.
Busy Waiting
Continuously checking a condition in a loop, wasting CPU cycles instead of using efficient wait mechanisms.
Thread-Per-Request
Spawning a new thread for every task, which does not scale well under load.
Unsafe Publication
Sharing objects between threads without proper synchronization, leading to visibility problems.
Double-Checked Locking (Pre-Java 5)
Incorrectly implemented lazy initialization in a multithreaded context.
5. Project & Process Anti-Patterns
These deal with team practices, software processes, and development workflows that undermine software quality over time.
Premature Optimization
Focusing on performance improvements before correctness or clear need.
Design by Committee
Too many stakeholders making conflicting design decisions, leading to diluted outcomes.
Cargo Cult Programming
Using patterns or frameworks without understanding why or how they work.
Over-Engineering
Designing systems with unnecessary flexibility or complexity that’s never used.
Failure to Refactor
Accumulating technical debt due to fear or laziness in cleaning up messy code.
Last updated