Layered Architecture (N-Tier)
Organize code into horizontal layers.
“Presentation -> Business -> Persistence -> Database”
The traditional enterprise monolith.
graph TD
UI[Presentation Layer] --> BL[Business Logic Layer]
BL --> DA[Data Access Layer]
DA --> DB[Database]
When to use
- Simple CRUD Apps: Standard structure.
- Enterprise Apps: Java Spring, .NET.
Explanation
- Strict Layering: A layer can only call the layer directly below it.
- Separation: Changes in UI shouldn’t affect DB.
Pros and Cons
| Pros | Cons |
|---|---|
Code example
Typescript