Ports and Adapters
summary
Architecture makes the domain the sole dependency-free core and defines primary/secondary ports as the boundary and primary/secondary adapters as thin converters with no business logic. Example: a task domain exposes AddTask -> TaskId, requires UserRepository.exists and TaskRepository.save, and publishes events via EventPublisher. Transactions live in the primary adapter and propagate to secondary adapters. Benefit: unit-testable domain, quick swap of databases (one migration done day-to-day), downside: extra interfaces, cognitive overhead and runtime translation cost.
AI-written summary · about
chapters (15)
- 0:00Introduction to talk
- 1:15Traditional layered architecture
- 3:04Problems with traditional architecture
- 6:18Ports and Adapters solution
- 7:21Ports and Adapters explained
- 14:08Advantages of the approach
- 19:49Disadvantages and challenges
- 25:52When to use this architecture
- 26:12Implementation tips
- 31:16Real-world example
- 34:45Multiple domains interaction
- 37:15Legacy system integration
- 40:04Advanced patterns
- 43:14Related architectures
- 44:17Summary and Q&A
