Foreword
Preface
- What is the goal of this book?
- Who should read this book?
- The example application
- Print version
- Feedback
- Notes about the second edition
1. Maintainability
- What does maintainability even mean?
- Maintainability enables functionality
- Maintainability generates developer joy
- Maintainability supports decision-making
- Maintaining maintainability
2. What’s Wrong with Layers?
- They promote database-driven design
- They’re prone to shortcuts
- They grow hard to test
- They hide the use cases
- They make parallel work difficult
- How does this help me build maintainable software?
3. Inverting Dependencies
- The Single Responsibility Principle
- A tale about side effects
- The Dependency Inversion Principle
- Clean Architecture
- Hexagonal Architecture
- How does this help me build maintainable software?
4. Organizing Code
- Organizing by layer
- Organizing by feature
- An architecturally expressive package structure
- The role of dependency injection
- How does this help me build maintainable software?
5. Implementing a Use Case
- Implementing the domain model
- A use case in a nutshell
- Validating input
- The power of constructors
- Different input models for different use cases
- Validating business rules
- Rich versus anemic domain model
- Different output models for different use cases
- What about read-only use cases?
- How does this help me build maintainable software?
6. Implementing a Web Adapter
- Dependency Inversion
- Responsibilities of a web adapter
- Slicing controllers
- How does this help me build maintainable software?
7. Implementing a Persistence Adapter
- Dependency inversion
- Responsibilities of a persistence adapter
- Slicing port interfaces
- Slicing persistence adapters
- An example with Spring Data JPA
- What about database transactions?
- How does this help me build maintainable software?
8. Testing Architecture Elements
- The test pyramid
- Testing a domain entity with unit tests
- Testing a use case with unit tests
- Testing a web adapter with integration tests
- Testing a persistence adapter with integration tests
- Testing main paths with system tests
- How much testing is enough?
- How does this help me build maintainable software?
9. Mapping between Boundaries
- The “No Mapping” strategy
- The “Two-Way” mapping strategy
- The “Full” mapping strategy
- The “One-Way” mapping strategy
- When to use which mapping strategy?
- How does this help me build maintainable software?
10. Assembling the Application
- Why even care about assembly?
- Assembling via plain code
- Assembling via Spring’s classpath scanning
- Assembling via Spring’s Java Config
- How does this help me build maintainable software?
11. Taking Shortcuts Consciously
- Why shortcuts are like broken windows
- The responsibility of starting clean
- Sharing models between use cases
- Using domain entities as the input or output model
- Skipping incoming ports
- Skipping services
- How does this help me build maintainable software?
12. Enforcing Architecture Boundaries
- Boundaries and dependencies
- Visibility modifiers
- Post-compile fitness function
- Build artifacts
- How does this help me build maintainable software?
13. Managing Multiple Bounded Contexts
- One hexagon per bounded context?
- Decoupled bounded contexts
- Appropriately coupled bounded contexts
- How does this help me build maintainable software?
14. A Component-Based Approach to Software Architecture
- Modularity through components
- Case study: Building a “Check Engine” component
- Enforcing component boundaries
- How does this help me build maintainable software?
15. Deciding on an Architecture Style
- Start simple
- Evolve the domain
- Trust your experience
- It depends
Changelog
- First edition
- Second edition
