SOLID & Design Patterns Interview Question #128

What is the Golden Hammer anti-pattern?

Anti-Patterns, Refactoring, DI Lifetimes & Senior Design Scenarios Senior Advanced

Quick Interview Answer

Golden Hammer is the tendency to use one familiar technology, pattern, or technique for many problems even when it is not a good fit. For example, forcing every application into microservices or using a repository abstraction for every trivial data operation.

Detailed Explanation

Golden Hammer is the tendency to use one familiar technology, pattern, or technique for many problems even when it is not a good fit. For example, forcing every application into microservices or using a repository abstraction for every trivial data operation.

Good design starts from requirements and constraints. Patterns are tools, not goals, and a simpler approach may be more maintainable.

Code Example

Problem -> evaluate constraints -> choose solution

// Not:
FavoritePattern -> force every problem
// into that pattern.