Implementing Hexagonal Architecture using Life Preserver and Spring Framework
We have all been there, the moment when someone asks you to make a change in the software, a change that you know you can’t do, at least not without a lot of effort, Russ Miles started his presentation at a recent meeting with the London Spring user group.
Russ calls this “the inconvenient truth of the killer change”; when you realise that the different assumptions about how the system or software will evolve was wrong and that you have to answer with some bad news.
Helping with this problem, Russ shares some techniques he uses when developing Java and Spring applications that helps him experience this moment less often. What he wants from a system is adaptability. The real world changes and we want to adapt to this, but the software we build is often less adaptable than we are as developers.
- Problems with traditional Layering, which is not how we develop software.
- Problems with Coupling, which e.g. show up when you do a refactoring in a development tool and lots of classes or files are changing, an evidence of of coupling.
- Entanglement, where multiple things are going on when there shouldn’t be, which makes the software harder to understand. This is also a common place for bugs.
Russ takes the hexagonal architecture a step further and has made what he calls the Life Preserver, a tool that lets him organise and visualise how an application is separated into different subdomains or components.
To show how his thoughts can be implemented using Java and Spring, Russ goes through an example with a real application, a simplified order processing system, which is an implementation of the hexagonal architecture using an event driven architecture with all subdomains communicating by sending messages.