What is the difference between GoF anti-patterns and the patterns themselves?
Answer
An anti-pattern is a common solution to a recurring problem that seems reasonable but actually makes things worse. Several GoF patterns become anti-patterns when misused. Singleton is widely considered an anti-pattern when overused: it introduces global mutable state, makes testing extremely difficult (hard to mock), and creates hidden coupling. The solution is dependency injection instead. Service Locator (not GoF but related) hides dependencies and makes code hard to test. God Object is what happens when Facade is taken too far — one class does everything. Premature abstraction is applying patterns (especially Abstract Factory or Strategy) before there is evidence of needing extensibility, making simple code needlessly complex. The lesson: patterns are tools, not goals — always weigh the added complexity against the actual benefit.
Previous
How do the SOLID principles relate to GoF patterns?
Next
How are GoF patterns used in modern frameworks like Spring and Django?
More Design Patterns (Gang of Four) Questions
View all →- Advanced How do you implement a thread-safe Singleton using double-checked locking?
- Advanced How do the SOLID principles relate to GoF patterns?
- Advanced How are GoF patterns used in modern frameworks like Spring and Django?
- Advanced What criteria should guide pattern selection?
- Advanced How do GoF patterns apply in functional programming?