Make Your Code More Testable

Refactoring to Hexagonal Architecture

This course shows you how easy it can be to make your code—even legacy code—testable.

Join the waiting list

Be the first to find out when
the course re-opens.

    Unhappy Seeing Red?

    You Know Tests Are Important

    You have enough experience building software systems that you know automated developer tests are important in order to continue to deliver features safely.

    You Hate Your Tests

    You've given up on "unit tests" and now everything is an "integration test", yet bugs continue to escape. Despite your best efforts, you struggle with tests that are slow, unreliable, or hard to understand. When you make a change, far-flung tests seem to fail for no obvious reason.

    Why Is Writing Them So Hard?

    The problem isn't you, it's the way your code is organized. You need a way to have your tests give you useful feedback that tells you precisely where things went wrong.

    Hexagonal Architecture Can Help

    You need to create clear boundaries between your valuable domain logic and the code that connects it to the rest of the world. Hexagonal Architecture helps you do that.

    Now You Can
    Finally Understand
    Hexagonal Architecture

    You'll be guided, step-by-step—with hands-on exercises and detailed solutions—through every part of the architecture:

    • Learn why Separation of Concerns holds the key to testability.
    • Understand Test Doubles and stop living in Mocking Hell.
    • See how to use Predictive Test-Driven Development to confidently add new functionality.
    • Get better at knowing how to Refactor your code (and tests) to Hexagonal Architecture using advanced Refactoring Maneuvers.
    Illustration of person with an satisfied look on their face and a large light bulb in the background.

    Is This Course for You?

    If you struggle to write JUnit tests for your code, especially when you have complex domain (business) logic mixed with I/O and calls to external services, then this course will help you organize (and re-organize) your code to make testing easier.

    Whether you write code in a "monolith" or as microservices, you'll find you'll quickly be able to apply the Hexagonal Architecture to your own work.

    After taking the [live] course, I finally have clarity about where code belongs and why. Now when I refactor, I know what direction to take to make the architecture better. I am also much better able to explain and justify to my colleagues why the code is better.

    What You Need for Your Journey

    This course assumes you are fluent in reading Java 8 (or later) code and can write Java without much help. If you're new to Java, or don't have much experience with writing unit tests, this course probably isn't for you.

    IntelliJ IDEA logo.

    The course is taught using Java and the powerful development environment, IntelliJ IDEA from JetBrains. I use IntelliJ IDEA because of its powerful refactoring tools, which you will learn along the way.

    Spring Boot

    For the sections that integrate with external services and databases, Spring Boot 3.x is used. You don't have to be an expert in Spring Boot, everything you need to know will be covered.

    Your Hexagonal Architecture Tour Guide

    Hi, I'm Ted M. Young,

    I've been coding Java in some of the largest codebases at eBay, Google, Apple, and others.

    Through the years, I've learned that testability of code is vital to sustaining development and avoiding tech debt. Everything I've done for the past 20+ years has been about finding ways to make that easier.

    I've spent over 2 years creating, teaching, and refining this course, pulling in everything I know about writing and refactoring to testable code. I've taught this course as a live workshop over 40 times to over 700 developers at large companies around the world.

    Now I'm thrilled to bring it to you as a self-paced course.

    All the Hexagonal Content You Need

    The course consists of ten in-depth modules, combining diagram-packed explanations with lots of test-driving of code and advanced refactoring techniques.

    The Project

    After learning about the different parts of Hexagonal Architecture, we dive into our course project: a game of Blackjack.

    Exercises: How You'll Learn

    Through over a dozen exercises—with detailed walk-throughs for each one—we'll transform the console-based game into one with a web UI. Along the way, we separate the code, placing each piece of code where it belongs, guided by the fundamental rules of Hexagonal Architecture.

    Ten In-Depth Course Modules

    Each module has multiple segments that will be released when completed.
    (Availability dates are subject to change.)


    Compares and contrasts Hexagonal Architecture to ones you might be familiar with.

    Status: Published!

    Separating Concerns

    Stop trying to test code that mixes Domain Logic with I/O and infrastructure.

    Status: Published!

    Refactoring to an Adapter

    Create a console-based adapter that holds all of the console-specific code. Learn about Data Transfer Objects and packaging your code.

    Status: In Progress

    More Than Mocks

    How do you test collaborating objects that are unreliable or unpredictable? Test Doubles.

    Status: Coming in March

    Test-Drive a New Adapter

    Introduce a Spring MVC-based Web UI adapter using the Predictive TDD process. The UI uses Spring Boot and the Thymeleaf Template Engine.

    Status: Coming in March

    Layers Inside the Hexagon

    The Application Services Layer (also called Use Case Layer) and the Domain Layer have very specific purposes.

    Status: Coming in March

    Ports and Outbound Adapter: Notifier

    Ports give us a testable way to send information to an external service.

    Repository: A Special Port

    Most applications need to store and retrieve data from a database. This is how to do it the test-driven way.

    Outbound Adapter: Fetcher

    External services have information our application needs, this is how we get it.

    Wrapping Up

    Each application has its own needs, but with Hexagonal Architecture, they are structured in a similar way. Let's dig into some other applications using this architecture.

    Learning about Hexagonal Architecture helped me focus on what really matters: the domain. I was able to fix anemic domain models in my projects and put the behavior where it belonged. I can now keep the outside world well-isolated from the domain code, which makes those projects more flexible and easier to maintain.

    My test suites are now faster, because more of my tests run against the core of my system and never touch slower infrastructure.

    Early Access Course Pricing

    Basic Journey


    Learn at your own pace

    • All 10 Modules
      As they're released.

    • Discord Community
      Ask questions and discuss the material with the community.

    • Full source code
      You'll get all the code from exercise solutions, lesson demonstrations, and more.

    • All Basic Updates Forever
    • Weekly Office Hours
      No access to weekly, live office hours.

    • Deep-Dive Excursions
      No access to monthly, deep-dive workshops.

    • Learning Ensembles
      No access to weekly, learning ensembles.

    Sale Ended. Wait List?

    Group Guided Tour

    (3 Months)


    Everything in the Basic Journey, plus 3 months of learning help with

    • Weekly Live Office Hour Zoom
      Get questions answered and access to recorded office hour sessions.

    • Exclusive Excursions
      Live workshops on related topics, with access to recordings.

    • Premium Community
      Access to private Discord channels for more personal help.

    • Learning Ensembles
      Join 2-4 others to practice skills in live group coding sessions (details).

    Sale Ended. Wait List?

    Private Guided Tour

    (3 Months)


    3 months of everything in the Basic Journey and Group Guided Tour, plus

    • 2 hours of Private Coaching
      1-on-1 time with Ted: get direct help with course exercises, feedback on your code, or discuss software development.

    • Priority Access to Learning Ensembles
      Space will always be available for Private Guided Tour members.

    Sale Ended. Wait List?

    Got a Question? Here's Answers to Common Ones.

    Frequently Asked Questions

    What do I get when I buy?

    Once I've processed your purchase, you'll get access to all published course segments and the private Discord channel. You'll then get emails as new course segments are published. If you buy the Guided Tour (group or private), you'll also be invited to join the private Discord channels when you complete your purchase.

    When will the course be finished?

    It's expected (but not guaranteed—I'm only human) that all modules will be completed in 2024. If you purchase the course during this limited Early Access, you get new content as it's completed.

    Why are you only offering 3 months of Guided Tours?

    That matches the expected time for me to release the entire course. Once the 3 months are up, the course will go on sale again with a variety of subscription options for continued Guided Tours (the tour never ends!). As early-access buyers, you'll get a discount on any subscription offered.

    What Excursions are Planned?

    Excursions are mini-modules that are first presented as live webinars for those in the Group Guided Tour or Private Guided Tour groups. Planned excursions include:

    • Validation
    • HTTP APIs
    • Security
    • Exception handling
    • Domain events
    • Sharing I/O (e.g., Websockets) across adapters
    • ...and much more, based on interest

    Is there closed captioning for the videos?

    Yes. All videos are in English and have English closed captioning (subtitles). Separate transcriptions are also available for each video.

    I don't work in Java, can I still take this course?

    All the code is in Java, so you will at least need to be able to read Java code.

    C#: Java and C# are similar enough that you will likely get a lot out of the course.

    PHP: I have had a number of people who code in PHP who found the course valuable.

    Others: For languages such as Python and JavaScript, it will likely be less useful to you, but you can always try it and if it doesn't work for you, get a full refund (within 30 days of purchase).

    Is this a cohort-based class?

    [A cohort-based class is where students all move through the course materials together at the same time.]

    While everyone will get newly completed videos and materials at the same time, this is not a "cohort" class where you are expected to finish watching the videos and doing the exercises by a deadline. For those in the Guided Tours, the questions and discussion will naturally be about any recently released materials, but we will also discuss topics related to the course.

    What are Learning Ensembles?

    You might know them under the name Mob Programming.

    Every week, I gather 3-5 coders in a live session over Zoom to practice our skills in TDD, refactoring, object-oriented design, and hexagonal architecture. Over the 90-120 minute session (length varies), every person gets several chances at being the "driver" (the one who types) and the "navigator" (the one who provides directions to the Driver).

    These private, small, hands-on groups provide the best way to practice and learn new skills. Because they need to be small, availability is on a first-come, first-serve basis (multiple ensembles are run each week). Those who purchase the Private Guided Tour will never be denied access to an Ensemble. If you are in the Group Guided Tour, you might be denied access if space has filled up.

    Do you offer team pricing?

    Yes! Contact me at and provide details about your team or organization.

    Do you offer special pricing for students?

    This is an advanced course, but if you think you're ready, email me at Let me know you're a student and where you're enrolled, and I'll give you a discount coupon.

    This is too expensive for me in my country, can I get a discount?

    I believe in providing Purchase Power Parity. Email me at and let me know what country you're in, and I'll give you a discount coupon.

    What if I don't like the course?

    If you're not happy, then I'm not happy. Let me know within 30 days of your purchase, and I'll refund your entire purchase price. No questions asked, and you get to keep any materials you've already downloaded.

    I Have Another Question

    If you still have questions, email me at:

    Make Your Code More Testable With Refactoring, TDD, and More!

    IntelliJ IDEA and the IntelliJ IDEA logo are registered trademarks of JetBrains s.r.o. Logo Copyright © 2022. Neither Ted M. Young, nor this course are affiliated with JetBrains, other than the support from free product subscriptions supplied by JetBrains.

    Copyright © 2022-2024 Ted M. Young. All rights reserved.