O'Reilly logo
live online training icon Live Online training

Domain-driven design and event-driven microservices

Learning a pathway to evolutionary architecture

Matt Stine

New architectural paradigms like microservices and evolutionary architecture, along with the challenges associated with managing data and transactional contexts in distributed systems, have generated a renewed interest in disciplined software design and modular decomposition strategies. The secret to obtaining the benefits of these architectures is getting the boundaries right, at both the team and the component and service levels, and then keeping them right as the software continues to evolve. This allows you to create a unified and ubiquitous language within the bounded contexts those boundaries enclose, facilitating productive and coherent conversations between the business and engineering sides of your organization.

Fortunately, there's a mature, battle-tested approach to domain modeling and system decomposition that is a perfect complement to these architectures: domain-driven design (DDD). Join expert Matt Stine to learn how to leverage DDD-based decomposition strategies, data architecture patterns, and implementations as you explore an exemplar business domain—a pizza delivery store.

What you'll learn-and how you can apply it

By the end of this live online course, you’ll understand:

  • Why DDD is an effective tool for designing evolutionary architectures
  • DDD basic concepts
  • The importance of the ubiquitous language
  • How DDD can be effectively combined with multiple technical architectures

And you’ll be able to:

  • Leverage event storming to arrive at a candidate domain model
  • Translate an event storm into user stories
  • Effectively apply DDD patterns such as bounded context, aggregate, and domain event to design modules that can be evolved into event-driven microservices
  • Effectively leverage hexagonal architecture to implement modules that can be evolved into event-driven microservices

This training course is for you because...

  • You're a software developer who wants to apply best practices for implementing microservice architectures.
  • You're a solutions architect who wants to apply best practices for designing microservice architectures.
  • You're a data engineer or architect who wants to apply best practices for supporting microservice architectures.


  • Basic familiarity with domain-driven design concepts, technical architecture concepts, and test-driven development
  • A working knowledge of Java and automated testing libraries (e.g., JUnit, Mockito, and AssertJ)
  • A basic understanding of Git and GitHub
  • Experience building or designing medium to large-scale enterprise applications (useful but not required)

Materials or downloads needed in advance:

  • A machine with Java 8, a recent version of Maven, Git, and the IDE/editor of your choice installed (make sure you also have the Lombok plug-in installed)
  • A GitHub account
  • A TravisCI account
  • A free RealtimeBoard account (useful but not required; alternatively, use the presentation or diagramming tool of your choice)

Assignments to be completed prior to the course:

Download the course materials and complete the setup instructions found on the course GitHub repository (info to come)

Recommended preparation:

About your instructor

  • Matt Stine is the global CTO of architecture at Pivotal, where he advises IT leadership on the effective adoption of cloud-native architectures. An 18-year veteran of the enterprise IT industry, with eight of them spent as a consulting solutions architect for a number of Fortune 500 companies and the not-for-profit St. Jude Children’s Research Hospital, Matt is obsessed with the idea that enterprise IT “doesn’t have to suck.” He spends much of his time thinking about Lean/Agile software development methodologies, DevOps, architectural principles, patterns and practices, and programming paradigms in an attempt to find the perfect storm of techniques that will allow corporate IT departments to not only function like startup companies but also create software that delights users while maintaining a high degree of conceptual integrity. Matt is the author of Migrating to Cloud-Native Application Architectures from O’Reilly and the host of the Software Architecture Radio podcast. He has spoken at conferences ranging from JavaOne to OSCON to YOW! and is an eight-year member of the No Fluff Just Stuff tour. Matt is also the founder and past president of the Memphis Java user group.


The timeframes are only estimates and may vary according to how the class is progressing

Day 1

Introduction (10 minutes)

Domain-driven design (15 minutes)

  • Lecture: What is DDD, and why do we need it?

Ubiquitous language (25 minutes)

  • Lecture: What is ubiquitous language, and why is it so important?
  • Q&A and group discussion: Why use DDD and ubiquitous language?

Break (10 minutes)

DDD 101: Strategic design (35 minutes)

  • Lecture: Bounded contexts; context mapping; subdomains
  • Q&A and group discussion: Strategic design

Break (10 minutes)

DDD 101: Tactical design (35 minutes)

  • Lecture: Aggregates, entities, value objects, domain events, application services, domain services (25 minutes)
  • Q&A and group discussion: Tactical design

Event storming (15 minutes)

  • Lecture: Overview of event storming

Break (10 minutes)

Pizza Shop event storming activity (55 minutes)

  • Interactive screen share: Introduction to the Pizza Shop domain
  • Q&A and group discussion: Event storming and the Pizza Shop domain
  • Hands-on exercise: Using the Pizza Shop domain, identify domain events, commands, actors, and aggregates using your whiteboard/diagram tool of choice
  • Interactive screen share: Pizza Shop event storming solution

From event storming to domain-driven design (20 minutes)

  • Lecture: How Event Storm concepts translate into DDD concepts, user stories, and TDD code
  • Q&A and group discussion: Day 1 AMA

Day 2

Day 1 recap (10 minutes)

DDD and technical architectures (25 minutes)

  • Lecture: DDD and technical architectures

Introduction to the Pizza Shop coding exercises (10 minutes)

  • Interactive screen share: Overview of the Pizza Shop coding exercise environment

Break (10 minutes)

Exercise 1: TDD aggregate root (25 minutes)

  • Hands-on exercise: Create kitchen commands with business logic and invariants
  • Interactive screen share: Solution

Exercise 2: TDD aggregate root (25 minutes)

  • Hands-on exercise: Create and publish kitchen domain events
  • Interactive screen share: Solution

Break (10 minutes)

Exercise 3: TDD aggregate repository (25 minutes)

  • Hands-on exercise: Create kitchen repositories and add domain events
  • Interactive screen share: Solution

Exercise 4: TDD aggregate repository (25 minutes)

  • Hands-on exercise: Rehydrate kitchen aggregates by reference
  • Interactive screen share: Solution

Exercise 5: TDD application service (25 minutes)

  • Hands-on exercise: Expose kitchen business interface and implement transactions
  • Interactive screen share: Solution

Break (10 minutes)

Exercise 6: TDD policy (25 minutes)

  • Hands-on exercise: Subscribe to a kitchen domain event from within an aggregate and create a CQRS view
  • Interactive screen share: Solution

Exercise 7: TDD policy (25 minutes)

  • Hands-on exercise: Subscribe to a kitchen domain event from an adjacent aggregate and update state
  • Interactive screen share: Solution

Wrap-up and Q&A (10 minutes)