(Icon) Pattern Name: (Subtitle)
๐ Overview
(Brief, 2-sentence elevator pitch of what the pattern does, why it exists, and its GoF category: Creational, Structural, or Behavioral.)
Core Concepts
- Concept 1: (Detail)
- Concept 2: (Detail) ...
๐ญ The Engineering Story & Problem
(Use this section to bridge the technical requirements with human intuition.)
๐ก The Villain (The Problem)
(Describe the messy code, tight coupling, or "if-else" nightmare that exists without this pattern. What is the business or technical pain point?)
๐ฆธ The Hero (The Solution)
(How this pattern saves the day conceptually. e.g., "Introducing Waiters as an intermediary so the Chef just cooks.")
๐ Requirements & Constraints
- (Functional): (e.g., Must support adding new types without changing core logic.)
- (Technical): (e.g., Thread safety, memory constraints.) ...
๐๏ธ Structure & Blueprint
Class Diagram
(The static structure: Who owns who? Who implements what?)
classDiagram
direction TB
class Interface {
<<interface>>
+method(): void
}
class ConcreteClass {
+method(): void
}
Interface <|.. ConcreteClass : Implements
Runtime Context (Sequence)
(The dynamic flow: How do objects talk to each other at runtime? Optional for simpler patterns.)
sequenceDiagram
participant Client
participant Target
Client->>Target: execute()
Target-->>Client: result
๐ป Implementation & Code
๐ง SOLID Principles Applied
- Single Responsibility: (How it's applied here)
- Open/Closed: (How it's applied here)
๐ The Code
The Villain's Code (Without Pattern)
โ๏ธ Trade-offs & Testing
| Pros (Why it works) | Cons (The Twist / Pitfalls) |
|---|---|
| (Pro 1) | (Con 1 - e.g., Increased complexity) |
| (Pro 2) | (Con 2) |
| ... |
๐งช Testing Strategy
(Briefly explain how this pattern makes testing easier or harder. e.g., "Because we depend on interfaces, we can easily inject Mock implementations during unit testing.")
๐ค Interview Toolkit
- Interview Signal: (What demonstrating this pattern tells the interviewer about your skills.)
- When to Use: (Quick bullet points on trigger scenarios/keywords in an interview prompt).
- Scalability Probe: (How does this handle high throughput or concurrency?)
- Design Alternatives: (Could we have used Pattern X instead?)
๐ Related Patterns
- Related Pattern 1 โ (How is it similar/different?)
- Related Pattern 2 โ (Can they be used together?) ...