What is This?
Battle-Tested Patterns collects programming patterns that are:
- Production-proven — used in top-tier projects like React, Linux kernel, Go runtime, and Chromium
- Interactive — every pattern has a hands-on SVG visualization you can click, drag, and experiment with
- Cross-language — idiomatic implementations in TypeScript, Rust, Go, and Python
- Code-level — concrete techniques you can apply today, not abstract architecture concepts
Why This Exists
There are plenty of "design patterns" books and "algorithms" repositories. But there's a gap:
| Existing Resources | What They Miss |
|---|---|
| Design Patterns (GoF) | Too abstract, too OOP-centric |
| Algorithm repositories | Disconnected from engineering practice |
| System Design guides | Architecture-level, not code-level |
| "Awesome" lists | Link collections, no teaching |
| Interactive tutorials | Usually one-off, not a systematic collection |
This project fills the gap: code-level techniques extracted from production source code, with interactive visualizations and precise references you can verify yourself.
What Makes a Pattern "Battle-Tested"?
Every pattern in this collection must have:
- ≥ 2 production proofs — precise GitHub links (to exact line numbers) showing the pattern in use
- Multi-language implementations — idiomatic code in TypeScript + at least one other language
- Runnable exercises — progressive difficulty levels with test suites
We never fabricate source links. If we can't find a verifiable reference, we don't include the pattern.
Recommended Learning Paths
Pick a path based on your background — or just browse freely.
Frontend Developer
Start with patterns you already use (possibly without realizing it):
- Diff / Patch — React's virtual DOM reconciliation
- Bitmask — React fiber flags
- Cooperative Scheduling — why React yields every 5ms
- Observer — Redux, EventEmitter
- Double Buffering — React Fiber's
current/workInProgress
Then see them compose: Patterns from React · Quick reference: Cheat Sheet
Backend / Systems Developer
Start with patterns that appear in databases and distributed systems:
- Write-Ahead Log — crash recovery in PostgreSQL, etcd
- MVCC — how readers never block writers
- Circuit Breaker — fail fast in microservices
- Rate Limiter — token bucket for throughput control
- Consistent Hashing — distribute keys across nodes
Then see the full picture: Patterns from Distributed Systems · Quick reference: Cheat Sheet
Performance / Low-Level Engineer
Start with memory and concurrency patterns:
- Arena Allocator — bump allocate, free all at once
- Object Pool — avoid GC pressure
- Free List — O(1) alloc/free
- Work Stealing — Go runtime, Tokio scheduler
- Ring Buffer — lock-free queues
Then see how they compose: Patterns from Go Runtime · Patterns from Linux · Quick reference: Cheat Sheet
How to Use This
- Play with visualizations — each pattern page has an interactive SVG visualization — click, drag, and build intuition
- Browse patterns — read the concept, study the production proof, then try the exercises
- Run exercises locally —
pnpm test:exercisesfor TypeScript,cargo testfor Rust,go testfor Go - Try it online — copy any code example into an official playground: TypeScript · Go · Rust · Python
- Contribute — see How to Contribute