Architectural Patterns Reference
This directory contains detailed references for 14 architectural patterns used in software design. Each pattern document includes the problem it solves, the solution approach, when to use it, when to avoid it, pseudocode, and runnable code examples in multiple languages.
Patterns
| # | Pattern | File | Summary |
|---|---|---|---|
| 1 | Repository | repository.md |
Abstract data access behind a collection-like interface |
| 2 | Unit of Work | unit-of-work.md |
Track and commit changes atomically |
| 3 | Service Layer | service-layer.md |
Define application boundaries with a service API |
| 4 | MVC | mvc.md |
Model-View-Controller separation |
| 5 | MVVM | mvvm.md |
Model-View-ViewModel with data binding |
| 6 | MVP | mvp.md |
Model-View-Presenter with passive view |
| 7 | CQRS | cqrs.md |
Separate read and write models |
| 8 | Event Sourcing | event-sourcing.md |
Store state as a sequence of events |
| 9 | Specification | specification.md |
Composable business rules as objects |
| 10 | Hexagonal / Ports & Adapters | hexagonal.md |
Isolate core logic from external concerns |
| 11 | Clean Architecture | clean-architecture.md |
Enforce the dependency rule across concentric layers |
| 12 | Microkernel | microkernel.md |
Minimal core with plug-in extensions |
| 13 | Layered Architecture | layered.md |
Horizontal layer separation |
| 14 | Pipe and Filter | pipe-and-filter.md |
Chained transformation stages |
How to Use These References
Each file follows a consistent structure:
- Problem - What design challenge the pattern addresses
- Solution - How the pattern solves it
- When to Use - Scenarios where this pattern excels
- When to Avoid - Scenarios where this pattern adds unnecessary complexity
- Pseudocode - Language-agnostic algorithm sketch
- Code Examples - Runnable implementations in Python plus Go or JavaScript
Categorization
Data Access Patterns
- Repository, Unit of Work
Application Structure Patterns
- Service Layer, Layered Architecture, Clean Architecture, Hexagonal
UI Separation Patterns
- MVC, MVVM, MVP
Domain Logic Patterns
- CQRS, Event Sourcing, Specification
System Composition Patterns
- Microkernel, Pipe and Filter