Design Patterns interview question · Most asked

What is an anti-pattern? Name a few common ones.

Summary

An anti-pattern is a common response to a recurring problem that looks reasonable but usually causes more harm than good. Common ones: the god object, singleton used as a global variable, service locator, golden hammer (one favourite solution for everything), speculative generality, copy-paste programming and the anemic domain model.

Longer Answer

Recognising them matters as much as knowing patterns: a 3,000-line OrderManager (god object) or container.get() calls inside business classes (service locator) are more common than missing patterns. Each has a known remedy: split by responsibility, inject dependencies, start from the problem, wait for the second case.

Key Points

  • Looks right, causes harm.
  • God object, singleton-as-global, service locator.
  • Golden hammer, speculative generality.
  • Each has a known remedy.

Deep dive: Design Patterns, Explained Simply: Anti-Patterns and Over-Engineering

Explanation

What interviewers look for

Several correct examples with remedies.

Follow-up questions

  • Which anti-pattern have you had to fix, and how?

More most-asked Design Patterns questions

← All Design Patterns questions