Course contentsShow
← Software Engineering
Lesson 321 of 1,9339. Behavioral Design PatternsFree lesson

The Pattern Addiction Anti-Pattern

Understanding how overuse of design patterns creates unnecessary complexity and obscures simple solutions.

The Pattern Addiction Anti-Pattern

You'll learn: Why forcing design patterns into your code when they're not needed creates more problems than it solves.


What is Pattern Addiction?

Pattern addiction happens when developers become so enamored with design patterns that they apply them everywhere—even where a simple, straightforward solution would work perfectly. It's like using a Swiss Army knife to butter toast: technically it works, but it's overkill.

After learning about patterns like Observer, Strategy, Visitor, and all the others, there's a temptation to see every problem as an opportunity to showcase pattern knowledge. This leads to code that's needlessly complex, harder to understand, and more difficult to maintain.

The Core Problem

Design patterns solve specific, recurring problems. When you force them into situations that don't require them, you introduce unnecessary abstraction layers, extra classes, and indirection. A simple function or class suddenly becomes five classes with interfaces and factories—not because the problem demands it, but because you wanted to use a pattern.

Real-World Example

Imagine you need to format a string. Pattern addiction might lead you to create a Strategy pattern with multiple concrete strategies, a factory to create them, and an interface defining the contract—when all you needed was a single method.

The pattern doesn't make the code better; it makes it harder to read and modify.

How to Avoid It

Ask yourself: "Does this pattern solve a real problem I have right now?" If the answer is "not yet" or "maybe someday," start with the simplest solution. Patterns should emerge from necessity, not be imposed from the start.

Key Takeaway: Design patterns are tools, not goals. Use them when they genuinely simplify your design, not to demonstrate knowledge or prepare for hypothetical future needs.