...

/

Architecturally Expressive Package Structure

Architecturally Expressive Package Structure

Learn what an architecturally expressive package structure looks like and how it can help you develop Clean Architecture.

We'll cover the following...

Project structure

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:

buckpal
└── account
    ├── adapter
    |   ├── in
    |   |   └── web
    |   |       └── AccountController
    |   ├── out
    |   |   └── persistence
    |   |       ├── AccountPersistenceAdapter
    |   |       └── SpringDataAccountRepository
    ├── domain
    |   ├── Account
    |   └── Activity
    └── application
        ├── service
        |   └── SendMoneyService
        └── port
            ├── in
            |   └── SendMoneyUseCase
            └── out
                ├── LoadAccountPort
                └── UpdateAccountStatePort

Explanation

Each element of the architecture can directly be mapped to one of the packages. On the highest level, we again have a package named account, indicating that this is the module implementing the use cases around an Account. ...