Hexagonal architecture organizes an application around business logic. A domain layer contains that logic, while application services coordinate use cases and communication with external applications. section 5.3 section 5.5
Apply three structural rules:
- Keep domain classes responsible for business logic rather than external concerns. section 5.3
- Direct dependencies from application services toward the domain; domain classes depend only on one another. section 5.5
- Connect external applications through interfaces maintained by application services instead of exposing the domain directly. section 5.5
Purchasing through an application service
A purchase service retrieves a customer and product, invokes the customer's purchase operation with a store interface, and sends a receipt through an email gateway only after success. The domain remains separate from those external applications. section 5.3
Figure 5.8. A typical application consists of a domain layer and an application services layer. The domain layer contains the application’s business logic; application services tie that logic to business use cases.
Use the layer diagram to distinguish the domain's business logic from application services that connect it to business use cases. section 5.3





