CASE FILE · 10

Read code. Name the pattern. Explain why.

Real production-style code, no hints, four options. Build the pattern-recognition instinct interviewers actually test.

No hints givenOne correct answer
Start detecting

23 Gang-of-Four patterns · All difficulty levels

PaymentService.java
public interface PaymentProcessor {
    void process(Payment payment);
}

public class PayPalProcessor implements PaymentProcessor {
    public void process(Payment payment) {
        // PayPal-specific processing logic
    }
}

public class StripeProcessor implements PaymentProcessor {
    public void process(Payment payment) {
        // Stripe-specific processing logic
    }
}

public class PaymentService {
    private PaymentProcessor processor;

    public PaymentService(PaymentProcessor p) {
        this.processor = p;
    }
}

Which pattern does this implement?

AFactory Method
BStrategy Pattern
CObserver Pattern
DDecorator Pattern
Investigation procedure

Three steps. No shortcuts.

01

Read the system code

Study the code structure — the classes, interfaces, and the relationships between them. No labels, no category hints. Just evidence.

02

Identify the pattern

Four options, all plausible. The distractors are patterns that share surface-level similarity with the correct answer — close enough to be genuinely challenging.

03

Reveal the explanation

Why the correct answer fits. Why each wrong option does not. Which specific structural cues in the code were the giveaways.

Evidence catalogue

All 23 Gang-of-Four patterns covered.

Every scenario is drawn from the canonical GoF library — no pattern is missing, no pattern is repeated beyond what the difficulty spread requires.

Creational

SingletonFactory MethodAbstract FactoryBuilderPrototype

Structural

AdapterBridgeCompositeDecoratorFacadeFlyweightProxy

Behavioral

Chain of ResponsibilityCommandIteratorMediatorMementoObserverStateStrategyTemplate MethodVisitorInterpreter
Investigation report

What the evidence shows.

Real production-style code

Scenarios are modeled on real systems — not abstract textbook examples. You learn to spot patterns in the kind of code you actually encounter in interviews and on the job.

23 patterns covered

All 23 Gang-of-Four patterns — Creational, Structural, Behavioral — appear across the scenario library, from beginner Singleton to advanced Visitor.

Wrong-answer explanations

The explanation covers all four options, including the ones you did not pick. Understanding why an Observer is not a Mediator is as important as knowing what an Observer is.

Difficulty levels

Scenarios range from beginner (Singleton, Factory) to advanced (Visitor, Interpreter). You can filter by difficulty or cycle through all levels.

One unambiguous answer

Every scenario has exactly one correct pattern. There are no "it depends" scenarios — the code is authored to implement a single pattern clearly and without ambiguity.

Structural cue training

Explanations teach you what to look for — not just that a pattern is present, but which specific class relationships and method signatures signal it.

Candidate profile

Built for engineers who recognise patterns in books — not yet in code.

The gap between knowing what a Strategy Pattern is and recognising it in a real PaymentService is wider than most engineers expect. Pattern Detective closes that gap with deliberate, high-repetition exposure to real-structured code.

  • Engineers who have read about design patterns in books but freeze when asked "what pattern is this?" during an interview.
  • Candidates preparing for OOP design rounds where pattern identification is explicitly tested.
  • Anyone who understands patterns in isolation but struggles to recognise them in non-trivially structured real code.
  • Engineers who can name patterns but cannot articulate why a specific piece of code is or is not a particular pattern.

FAQ

Questions people ask