Pattern Page Template (Shared Explanation Shape)
Every file under patterns/<category>/<pattern>.md MUST follow this order.
Do not copy prose or diagrams from reference sites — write from scratch.
See content/MAPPING.md for single-source rules and guides/selection.md for the canonical chooser.
Intent
One or two sentences: what problem this pattern solves, in your own words.
Motivation
A small concrete scenario (3-6 sentences). Name the actors and the pain without the pattern (rigid branching, duplication, tight coupling, etc.).
Structure
Original diagram only. Use Mermaid (preferred) or ASCII. Example:
flowchart LR Client --> Context Context --> StrategyA Context --> StrategyB
List roles under the diagram:
- Role A — what it owns.
- Role B — what it owns.
Consequences
- Benefit: …
- Cost / trade-off: …
Basic Recap
3-5 sentences restating the pattern’s intent and core roles in your own words.
Complex Scenario
A work-like situation with at least two edge cases and a non-runnable pseudocode sketch.
When to Use / When Not to Use
Use when:
- …
Avoid when:
- …
Examples
Links to runnable code (same scenario, four languages):
examples/elixir/<pattern>/examples/dart/<pattern>/examples/go/<pattern>/examples/rust/<pattern>/
Expected outcome: one line describing what running any of them prints or proves.
Anti-pattern / Failure Mode
One misuse symptom plus one review signal, followed by the expanded failure-mode guidance and edge cases formerly kept in the depth page.
Related
Links to 2-4 neighbors: at least one same-pillar pattern and at least one cross-pillar link (architecture page, principle, or practice capstone) with one line on how they differ or combine.
Exercise
A small task (extend or break the example).
Self-check
2-3 questions. Answers in <details> collapsed block or answers.md next to the page.