All Patterns: Quick Reference Card
📚 REFERENCE | All 20 patterns at a glance
Quick lookup for all patterns. Use this to find a pattern and jump to its full description.
Testing Patterns (5)
| # | Pattern | Problem | Solution | Learn More |
|---|---|---|---|---|
| 1 | AAA Pattern | Tests are unreadable | Structure into Arrange-Act-Assert | → |
| 2 | Error Path Testing | Failures aren't tested | Test both success AND error paths | → |
| 3 | Boundary Conditions | Edge cases are missed | Systematically test limits | → |
| 4 | Resource Cleanup | Tests leak resources | Automatic fixture cleanup | → |
| 5 | Real Collaborators | Mocks hide bugs | Test with real implementations | → |
Key: These 5 patterns are the foundation. Use them in every test.
Architecture Patterns (5)
| # | Pattern | Problem | Solution | Learn More |
|---|---|---|---|---|
| 6 | Generic Base Layer | Code duplication | Extract generic abstractions | → |
| 7 | Extension Layer | Can't extend without modifying | Add layers for safe extension | → |
| 8 | Composition Over Duplication | DRY violations | Compose instead of copying | → |
| 9 | Single Source of Truth | Data inconsistencies | One canonical source | → |
| 10 | Capability Grouping | Monolithic modules | Organize by capability | → |
Key: These 5 patterns organize code structure. Use during architecture phase.
Design Patterns (10)
| # | Pattern | Problem | Solution | Learn More |
|---|---|---|---|---|
| 11 | Zero-Cost Abstractions | Abstractions are slow | Use generics, compile away overhead | → |
| 12 | Type Safety with GATs | Type errors at runtime | Generic Associated Types | → |
| 13 | Sealed Traits | API is too easy to misuse | Seal traits to prevent misuse | → |
| 14 | Compile-Time Validation | Errors caught at runtime | Validate during compilation | → |
| 15 | Type State Enforcement | State machines are error-prone | Encode states in the type system | → |
| 16 | Fixture Lifecycle | Complex test setup | Manage with sealed traits | → |
| 17 | Builder-Driven Test Data | Building test data is tedious | Fluent builders for data | → |
| 18 | Timeout Defense | Tests hang indefinitely | Timeout defense in depth | → |
| 19 | Feature Gate Slices | Feature flags are unreliable | Slice-based feature gating | → |
| 20 | Macro Pattern Enforcement | Patterns are easy to violate | Use macros to enforce | → |
Key: These 10 patterns provide safety, performance, and design tools. Use during implementation.
Pattern Organization
By Complexity (Learning Path)
Phase 1 - Foundation (Read First)
- Pattern 1: AAA Pattern
- Pattern 2: Error Path Testing
- Pattern 3: Boundary Conditions
Phase 2 - Production Ready (Read Next) 4. Pattern 4: Resource Cleanup 5. Pattern 5: Real Collaborators 6. Pattern 17: Builder-Driven Test Data
Phase 3 - Architecture (Advanced) 6. Pattern 8: Composition Over Duplication 7. Pattern 10: Capability Grouping 8. Pattern 9: Single Source of Truth
Phase 4 - Advanced Design (Mastery) 11. Pattern 11: Zero-Cost Abstractions 12. Pattern 13: Sealed Traits 13. Pattern 15: Type State Enforcement 14. Pattern 20: Macro Pattern Enforcement
By Category (Type System)
Testing Patterns: Patterns 1-5 Architecture Patterns: Patterns 6-10 Design Patterns: Patterns 11-20
By Problem Domain
Testing Problems: Patterns 1-5, 17 Code Organization: Patterns 6-10 Type Safety: Patterns 12, 14, 15 API Design: Patterns 13, 20 Performance: Pattern 11 Robustness: Pattern 18 Reliability: Pattern 19
How to Use This Card
- Find your problem in the Problem column
- See the solution in the Solution column
- Click Learn More to read the full pattern
- Bookmark the pattern for future reference
Quick Links
| Want to... | Go to... |
|---|---|
| Choose a pattern | Choosing Your Pattern |
| Learn testing | Testing Learning Sequence |
| Learn architecture | Architecture Learning Sequence |
| Learn design | Design Learning Sequence |
| All 20 patterns | This page (you are here) |
Pattern Dependencies
Some patterns build on others. Recommended learning order:
Pattern 1 (AAA)
├─→ Pattern 2 (Error Paths)
├─→ Pattern 3 (Boundaries)
├─→ Pattern 4 (Resource Cleanup)
└─→ Pattern 5 (Real Collaborators)
└─→ Pattern 17 (Builder Test Data)
Pattern 6 (Generic Base)
└─→ Pattern 8 (Composition)
└─→ Pattern 10 (Capability Groups)
Pattern 14 (Compile-Time)
└─→ Pattern 15 (Type State)
Pattern 13 (Sealed Traits)
└─→ Pattern 20 (Macro Enforcement)
Statistics
| Metric | Value |
|---|---|
| Total Patterns | 20 |
| Testing Patterns | 5 |
| Architecture Patterns | 5 |
| Design Patterns | 10 |
| Difficulty Range | Beginner → Advanced |
| Total Learning Time | ~10 hours |
| Estimated Implementation | 2-3 weeks |
Pro Tips
💡 Tip 1: You don't need to learn all 20 patterns at once. Start with Testing (1-5), then add what you need.
💡 Tip 2: Patterns often appear in combinations. When you use Pattern 5 (Real Collaborators), you'll probably also use Pattern 17 (Builder Test Data).
💡 Tip 3: Look for patterns in the codebase you're reading. The more you see patterns, the better you'll understand them.
💡 Tip 4: Bookmark the Decision Guide. You'll return to it when solving problems.
Next: Choose your learning path or jump to a pattern you need right now!