Level 5: Enterprise Application Architecture
Structure a business application into layers, choose how domain logic and data access are organised, and understand what your framework does for you.
Outcome: Structure a business application into layers, choose how domain logic and data access are organised, and understand what your framework does for you.
The recurring structures inside every business app — from Fowler’s enterprise application patterns (layering, Service Layer, Repository, Unit of Work, DTOs, offline locks) to Hohpe & Woolf’s messaging patterns for connecting systems.
The pressure on ShopFlow: Business rules leak into controllers and SQL; nobody knows where logic belongs.
Lessons in level 5
- Layered Architecture: Presentation, Domain, Data — Why separating layers helps — and how layers become a lasagne of pass-through code.
- Transaction Script vs Domain Model vs Table Module — Three ways to organise business logic, chosen by how complex the logic is.
- Service Layer: One Front Door for Every Use Case — Define application boundaries, transactions and orchestration in one place.
- Active Record vs Data Mapper (and the Gateways) — Should objects save themselves, or should a mapper keep them ignorant of the database?
- Repository: A Collection-Like Home for Aggregates — Let the domain ask for objects without knowing about SQL.
- Unit of Work, Identity Map & Lazy Load — What JPA/Hibernate does for you — and how it surprises you (N+1, dirty checking).
- MVC, Front Controller & Friends — How Spring MVC’s DispatcherServlet embodies decades-old presentation patterns.
- Remote Facade & DTO: Designing Across the Network — Coarse-grained APIs and data transfer objects for expensive remote calls.
- Optimistic vs Pessimistic Offline Locks — Protect business transactions that span several requests.
- Enterprise Integration Patterns: Messaging Between Systems — Channels, routers, translators, dead letters and idempotent receivers.
Source books
- PEAA — Martin Fowler
- Enterprise Integration — Gregor Hohpe, Bobby Woolf