SOLID & Design Patterns Interview Question #148

How do you recognize over-engineering in a design?

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

Quick Interview Answer

Over-engineering often appears as many abstractions with no demonstrated variation, excessive indirection for simple operations, infrastructure chosen for hypothetical scale, or patterns that make a small feature difficult to trace.

Detailed Explanation

Over-engineering often appears as many abstractions with no demonstrated variation, excessive indirection for simple operations, infrastructure chosen for hypothetical scale, or patterns that make a small feature difficult to trace.

Evaluate whether each layer or pattern solves a current requirement, protects an important boundary, or addresses measured risk. Removing unnecessary architecture can be as valuable as adding missing structure.

Code Example

// Warning signs:
Controller
 -> Mediator
 -> Handler
 -> ApplicationService
 -> DomainService
 -> GenericRepository
// ...for a trivial lookup with no rules.

// Each boundary should have a reason.