Software Anti-Patterns & Design Pattern Misuse
Common software design anti-patterns, misuse of design patterns, code smells indicating trouble, and refactoring strategies to fix them.
Common software design anti-patterns, misuse of design patterns, code smells indicating trouble, and refactoring strategies to fix them.
Common software anti-patterns and design-pattern misuse with aliases, symptoms, root cause, consequences, refactoring and related patterns: God Object, Singleton overuse, spaghetti code, golden hammer, premature optimization, copy-paste programming, lava flow and big ball of mud.
| Name | Also known as | Symptoms | Root cause | Consequences | Refactoring | Related patterns | When genuinely needed | Prevention | Examples | Healthy approach |
|---|---|---|---|---|---|---|---|---|---|---|
| God Object | Blob, Cosmic Know-It-All |
| Failure to decompose domain logic, premature optimization centralization, or gradual feature creep without refactoring. |
| Identify cohesive groups of methods → Extract Class for each group → Extract Interface for contracts → Use Facade pattern to simplify API if needed → Apply Dependency Injection to decouple | Facade (bad when used to wrap a God Object instead of fixing it) | null | null | null | null |
| Singleton Overuse (Singletonitis) | null |
| Convenience of global access mistaken for good design, misunderstanding of when shared state is truly needed. |
| Replace Singleton with Dependency Injection → Inject dependencies via constructor → For truly single-instance needs, use DI container's singleton scope → Avoid global state accessor pattern | null | Logging framework, configuration manager (immutable after load), hardware interface (OS has one instance), thread pool manager | null | null | null |
| Spaghetti Code | null |
| Lack of design, deadline pressure, insufficient refactoring, or working in a language without structured programming support. |
| Extract Method religiously (every 5-10 lines) → Replace Conditionals with Strategy Pattern → Introduce layered architecture → Remove global state → Add unit tests as safety net during refactoring | null | null | Enforce cyclomatic complexity limits (CI gate: < 10 per method), mandatory code reviews, pair programming for complex features | null | null |
| Golden Hammer | Law of Instrument ("If all you have is a hammer, everything looks like a nail") |
| Team comfort zone, resume-driven development, over-generalization of past success, lack of diverse technical exposure. |
| Evaluate each problem independently → Document trade-off decisions → Use polyglot approach where justified → Invest in team technical diversity | null | null | null | Using microservices for a 3-page website, Event Sourcing for a CRUD app, Machine Learning when a simple rule suffices | null |
| Premature Optimization | null |
| Misapplication of "performance mindset", lack of profiling data, assumption-driven development. |
| Profile first, optimize second → Remove speculative complexity → Measure before/after → Apply Knuth's maxim: "Premature optimization is the root of all evil" | null | null | null | null | Design reasonable architecture upfront, implement simply, profile in production, optimize only measured bottlenecks |
| Copy-Paste Programming | null |
| Deadline pressure, laziness, lack of refactoring culture, inadequate code review, absence of abstraction skills. |
| Extract Method/Class for each duplicate → Parameterize variations → Template Method pattern for similar algorithms → Use code duplication detection tools (Simian, PMD-CPD) | null | null | CI gate with duplication threshold, code review requirement, pair programming for complex logic | null | null |
| Lava Flow | null |
| Rapid prototyping without cleanup, developer turnover without knowledge transfer, fear of removing unknown code. |
| Systematically identify dead code via code coverage tools → Remove confirmed dead code → Add tests for live code → Use version control history as safety net | null | null | Regular codebase cleanup sprints, enforce code coverage minimums, remove features entirely when deprecated | null | null |
| Big Ball of Mud | null |
| Organic growth without architectural oversight, no refactoring, short-term thinking, "just make it work" culture. |
| Strangler Fig pattern → Identify bounded contexts → Extract modules one by one → Define clear interfaces between modules → Add architectural tests to enforce boundaries | null | null | Architecture Decision Records (ADRs), architectural fitness functions, regular architecture reviews, CI-enforced module boundaries | null | null |
The shape of this dataset, read from the data itself: every column, its type and a real value. Agents can use this to plan a query without fetching the whole document.
| Section | Field | Type | Example |
|---|---|---|---|
| anti_patterns | name | string | God Object |
| anti_patterns | also_known_as | string | Blob, Cosmic Know-It-All |
| anti_patterns | symptoms | array | [4 items] |
| anti_patterns | root_cause | string | Failure to decompose domain logic, premature op… |
| anti_patterns | consequences | array | [4 items] |
| anti_patterns | refactoring | string | Identify cohesive groups of methods → Extract C… |
| anti_patterns | related_patterns | string | Facade (bad when used to wrap a God Object inst… |
| anti_patterns | when_genuinely_needed | string | Logging framework, configuration manager (immut… |
| anti_patterns | prevention | string | Enforce cyclomatic complexity limits (CI gate: … |
| anti_patterns | examples | string | Using microservices for a 3-page website, Event… |
| anti_patterns | healthy_approach | string | Design reasonable architecture upfront, impleme… |
The static files contain the same reference rows as the API, with no API rate limit. Live metadata, such as view counts, may differ. Use the API for content negotiation; use the static files for a cacheable snapshot.
curl "https://yjtoon.yunusemrevurgun.com/api/dataset/design-pattern-anti-patterns?format=toon"
const res = await fetch( "https://yjtoon.yunusemrevurgun.com/static-data/dataset/design-pattern-anti-patterns.toon" ); const toon = await res.text();
Rate limit: 120 requests per minute per IP, no key and no signup. API reference →