Repaso
Español

What is a design pattern, and why do interviewers ask about them?

Answer

  • A reusable, named solution to a common design problem in a given context (not a library, not copy-paste code).
  • Gives teams a shared vocabulary: saying "use a strategy here" explains a lot in one sentence.
  • Interviewers check that you can recognize a problem shape (many ways to do X, add behavior dynamically, notify many listeners) and choose a simple solution.
  • Name the pattern, state the problem it solves, give a Java example, mention trade-offs (more classes, more indirection).
  • Avoid over-engineering: simplest code that works first, patterns when change pressure appears.

Key terms

Practice this question in Repaso