Hexagonal Architecture Hands-on
Development teams often lose speed because domain logic gets entangled with frameworks, databases, APIs, and external dependencies. Over time, changes take longer and become riskier. Automated tests should help, but in practice they become brittle and get in the way.
Hexagonal Architecture (or Ports & Adapters) is an architecture pattern that helps structure a component or service to keep domain logic clear, testable, and decoupled from other concerns. It keeps software malleable and allows it to evolve safely. It is not tied to a specific programming language: we offer this course for Java, C#, C++, and Python.
Hexagonal Architecture is a pattern, not a best practice! It solves a problem in a context and comes with trade-offs. We have applied it successfully in different projects over the last 15 years, and in our experience, it usually pays off. The pattern was invented by Alistair Cockburn (of Agile Manifesto fame) in the 1990s, and it has proven its worth over time.
Hexagonal Architecture helps teams to achieve loosely coupled design that ‘speaks’ your domain language. It facilitates controlled evolution of domain logic, business rules, APIs, databases, and external dependencies.
This course is useful both for teams working on new applications or (micro)services and teams working on improving existing systems where business logic is entangled with other concerns. We offer this course in two variants:
- a 1-day course, focusing on the basics of Hexagonal Architecture;
- a 2-day course, with more practice time and covering guidelines for applying Hexagonal Architecture in existing entangled code.
Benefits
This course will help your teams to:
- reduce code complexity and improve maintainability, allowing developers to make changes faster, with more confidence;
- improve the quality and coverage of automated tests so that they facilitate change rather than hinder it;
- decrease coupling in existing codebases, reducing the risk of changes;
- reduce the risk of vendor lock-in and third party dependencies, keeping technology and framework changes manageable;
- facilitate onboarding of new developers.
Course outline
- Introduction to Hexagonal Architecture as an architectural pattern; compare it to the traditional layered architecture; we show how it helps to decouple domain logic from their surroundings in an embedded device or software as a service.
- Introduction to the case; we will facilitate a collaborative design exercise.
- In pairs, participants will explore the code we share and implement one or more user stories; we work in short rounds and take enough time to discuss solutions and reflect on learnings.
- We show how Hexagonal Architecture supports a balanced suite of automated tests: unit tests, integration tests, end-to-end tests.
- Only for the 2-day variant: we share guidelines for applying Hexagonal Architecture in existing, entangled code; in pairs, participants do a hands-on coding exercise, where they try to refactor an entangled codebase towards Hexagonal Architecture
This course mixes theory and hands-on experience through modelling and coding exercises. You don’t need to be a senior software developer, we will provide exercises at different levels of difficulty.
Learning objectives
After attending this training course, participants will be able to:
- explain Hexagonal Architecture, its trade-offs, and how it achieves better separation of concerns;
- explain the concepts of ports, adapters and domain logic;
- identify what parts of a feature or user story belong where: ports, adapters, or domain logic;
- reduce coupling by applying dependency inversion in an application or service;
- reduce dependencies on external systems or frameworks;
- design a balanced suite of automated tests at different levels: unit, integration, end-to-end;
- start refactoring an existing codebase towards Hexagonal Architecture.
Audience
Architects, software developers, CI/CD engineers, anyone involved in developing software or writing scripts
This workshop is suitable both for junior developers who want to grow and for medior and senior developers who’d like to sharpen their skills.
Practical information
- Duration: 1 or 2 days
- We will provide the training infrastructure; participants need to bring a laptop with a current web browser
- Basic programming skills are required
- This training is available as open enrolment and in-house.
- We offer this course for Java, C#, C++, and Python