Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
 Designing Hexagonal Architecture with Java

You're reading from   Designing Hexagonal Architecture with Java Build maintainable and long-lasting applications with Java and Quarkus

Arrow left icon
Product type Paperback
Published in Sep 2023
Publisher Packt
ISBN-13 9781837635115
Length 438 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Davi Vieira Davi Vieira
Author Profile Icon Davi Vieira
Davi Vieira
Arrow right icon
View More author details
Toc

Table of Contents (24) Chapters Close

Preface 1. Part 1: Architecture Fundamentals
2. Chapter 1: Why Hexagonal Architecture? FREE CHAPTER 3. Chapter 2: Wrapping Business Rules inside Domain Hexagon 4. Chapter 3: Handling Behavior with Ports and Use Cases 5. Chapter 4: Creating Adapters to Interact with the Outside World 6. Chapter 5: Exploring the Nature of Driving and Driven Operations 7. Part 2: Using Hexagons to Create a Solid Foundation
8. Chapter 6: Building the Domain Hexagon 9. Chapter 7: Building the Application Hexagon 10. Chapter 8: Building the Framework Hexagon 11. Chapter 9: Applying Dependency Inversion with Java Modules 12. Part 3: Becoming Cloud-Native
13. Chapter 10: Adding Quarkus to a Modularized Hexagonal Application 14. Chapter 11: Leveraging CDI Beans to Manage Ports and Use Cases 15. Chapter 12: Using RESTEasy Reactive to Implement Input Adapters 16. Chapter 13: Persisting Data with Output Adapters and Hibernate Reactive 17. Chapter 14: Setting Up Dockerfile and Kubernetes Objects for Cloud Deployment 18. Part 4: Hexagonal Architecture and Beyond
19. Chapter 15: Comparing Hexagonal Architecture with Layered Architecture 20. Chapter 16: Using SOLID Principles with Hexagonal Architecture 21. Chapter 17: Good Design Practices for Your Hexagonal Application 22. Index 23. Other Books You May Enjoy

Why Hexagonal Architecture?

Software that’s not well organized and lacks sound software architecture principles may work just fine but develop technical debt over time. As new features are added, the software may become more complex to maintain because there is no common ground to guide code changes. Based on that problem, this chapter explains how hexagonal architecture helps to build software prepared to accommodate changes from unexpected requirements and, by doing so, allows us to increase software maintainability and keep technical debt under control.

We tackle the technical debt problem that arises when shortcuts are taken to overcome the difficulty of introducing changes caused by an inflexible software architecture. We will see how hexagonal architecture helps us improve maintainability by providing the principles to decouple the business logic (code that should purely represent a business problem) from the technology code (code that integrates the system with different technologies such as databases, messaging queues, and external APIs to support the business logic).

I have seen systems developed with business logic closely related to the technology code. Some of those systems would rarely change, so the coupling between business logic and technology code would never be a problem. However, significant refactorings would be necessary for other systems where the requirements would change often and substantially. That was because the business logic was so tightly coupled with the technology code that rewriting the business logic was the only plausible solution.

Using hexagonal architecture may help you to save time and effort due to the software rewrites caused by such scenarios where requirements change often and significantly.

In this chapter, we will cover the following topics:

  • Reviewing software architecture
  • Understanding hexagonal architecture

By the end of this chapter, you will have learned about the main concepts of hexagonal architecture: entities, use cases, ports, and adapters. Also, you’ll know the basic techniques to start applying hexagonal principles in your projects.

You have been reading a chapter from
Designing Hexagonal Architecture with Java - Second Edition
Published in: Sep 2023
Publisher: Packt
ISBN-13: 9781837635115
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime