Layer
How to organize complex systems through layers and hierarchies. Breaking down big problems into manageable pieces.
Why Layers?
Layers help us manage complexity by creating clear boundaries:
- Each layer has one job
- Layers talk to each other through simple contracts
- Changes in one layer don't break others
- Systems can grow without becoming chaotic
Common Layers
ui— What users see and interact withbusiness— Core rules and workflowsdata— Storage and retrievalplatform— Infrastructure and services
Cross-System Concerns
auth— Who can do whatlogging— What's happening in the systemapi— How systems talk to each othercache— Making things faster
Design Principles
- Keep related things together
- Depend on abstractions, not concrete things
- Make interfaces small and focused
- Isolate changes within layers
Communication Patterns
top-down— Commands flow from UI to databottom-up— Events bubble up from data to UIsideways— Services talk to each othershortcuts— Direct paths for performance
In Practice
- Organize code into folders by layer
- Use consistent naming across projects
- Test each layer independently
- Test interactions between layers
Related
Works with entry patterns, value measurements, and std conventions.