Ports and Adapters in Java

Course Length: 3 Days

Build clarity and confidence in your architecture with “Ports and Adapters with Java” coaching. Each coaching session starts with a presentation on what Ports and Adapters are and how it is constructed. Then, we will build an application from scratch to solidify the fundamentals and demonstrate where everything fits.

This coaching program helps Java teams strengthen their architecture by applying Hexagonal (Ports and Adapters) principles in a practical, code-focused way.

ports adapters

Each session begins with a brief presentation to establish a shared understanding, covering domain-driven design concepts, application services, and adapter structures. From there, we work directly with your codebase (or through focused labs) to identify coupling issues, clarify responsibilities, and introduce modern Java techniques that reinforce clean design, including sealed classes, records, and pattern matching.

By the end, your team will have:

  • A clearer understanding of the architectural boundaries between domain, application, and infrastructure.

  • Refactoring strategies that improve testability and maintainability.

  • Practical experience applying modern Java language features to support a robust architecture.

This is not just a lecture—it’s hands-on architectural coaching built around your real-world challenges.

Day Topics and Activities

Day 1 – Foundations and Design

  • Module Layouts for a Full Java Application – Establish project structure with clear module boundaries and testing harnesses, including end-to-end tests using Testcontainers.

  • First Application in Ports and Adapters – Build a small web feature to experience adapter wiring in action.

  • DDD Strategic Design – Explore Ubiquitous Language and Bounded Contexts.

  • Behavior-Driven Development (BDD) – Translate stakeholder requirements into executable tests that guide your application.

  • DDD Tactical Design – Apply Value Objects, Aggregates, Application Services, Domain Events, and Domain Services.

Day 2 – Integration and Architecture

  • Acceptance Tests in Action – Implement behavior through Ports and Adapters using DDD tactical patterns.

  • Input Adapters – Connect your domain to the web layer with a clean controller design using Input Ports, Java sealed types, and Command/Result strategies.

  • Output Adapters – Integrate with databases, applying Testcontainers for authentic integration testing.

  • Rapid Development Practices – Establish consistent, repeatable patterns that accelerate team development.

  • Architectural Patterns in Context – Discuss CQRS, the Outbox Pattern, and their role in resilient systems.

  • Monoliths, Modular Monoliths, and Microservices – Learn how to divide, deliver, and maintain your application as it evolves.

Day 3 – Refactoring and Coaching

  • Refactoring Techniques with IntelliJ IDEA – Use modern tooling to safely restructure complex code and improve architecture.

  • Live Coaching Session – Scratch Refactoring – Work from a dedicated branch of your own project and perform guided refactoring using Scratch Refactoring techniques (from Michael Feathers’ Working Effectively with Legacy Code). You’ll commit your changes for review and discussion—but won’t merge them—creating a safe space for experimentation, feedback, and deep learning.