1 of 5
Architecture Styles
Hexagonal Architecture: Ports and Adapters
Isolate your domain from infrastructure by inverting dependencies — the application core knows nothing about HTTP, databases, or queues.
Hexagonal architecture (Alistair Cockburn, 2005) places the application core at the centre with Ports (interfaces) on the boundary and Adapters as the implementations that connect to the outside world. The domain never imports infrastructure code — it imports only its own interfaces. Infrastructure imports the domain. This makes it trivial to swap databases, test without HTTP, or add a new delivery mechanism.
Continue reading
- →
Dependency Injection and IoC Containers
Invert control of dependency creation to keep classes decoupled from their collaborators and trivially testable.
- →
The Observer Pattern and Event-Driven Design
Decouple publishers from subscribers by letting objects register interest in events without the producer knowing who is listening.
- →
The Strategy Pattern: Encapsulating Algorithms
Define a family of algorithms, encapsulate each one, and make them interchangeable — open for extension, closed for modification.