In a hexagonal architecture, we have entities, use cases, incoming and outgoing ports, and incoming and outgoing (or "driving" and "driven") adapters as our main architectural elements. Let's fit them into a package structure that expresses this architecture:
Figure 3.3: In an architecturally expressive package structure, each architecture element has its place
Each element of the architecture can directly be mapped to one of the packages. At the highest level, we again have a package named account, indicating that this is the module implementing the use cases around an Account.
On the next level, we have the domain package containing our domain model. The application package contains a service layer around this domain model. SendMoneyService implements the incoming port interface, SendMoneyUseCase, and uses the outgoing port interfaces, LoadAccountPort and UpdateAccountStatePort, which are implemented by...