Book Image

Domain-Driven Design with Java - A Practitioner's Guide

By : Premanand Chandrasekaran, Karthik Krishnan
Book Image

Domain-Driven Design with Java - A Practitioner's Guide

By: Premanand Chandrasekaran, Karthik Krishnan

Overview of this book

Domain-Driven Design (DDD) makes available a set of techniques and patterns that enable domain experts, architects, and developers to work together to decompose complex business problems into a set of well-factored, collaborating, and loosely coupled subsystems. This practical guide will help you as a developer and architect to put your knowledge to work in order to create elegant software designs that are enjoyable to work with and easy to reason about. You'll begin with an introduction to the concepts of domain-driven design and discover various ways to apply them in real-world scenarios. You'll also appreciate how DDD is extremely relevant when creating cloud native solutions that employ modern techniques such as event-driven microservices and fine-grained architectures. As you advance through the chapters, you'll get acquainted with core DDD’s strategic design concepts such as the ubiquitous language, context maps, bounded contexts, and tactical design elements like aggregates and domain models and events. You'll understand how to apply modern, lightweight modeling techniques such as business value canvas, Wardley mapping, domain storytelling, and event storming, while also learning how to test-drive the system to create solutions that exhibit high degrees of internal quality. By the end of this software design book, you'll be able to architect, design, and implement robust, resilient, and performant distributed software solutions.
Table of Contents (17 chapters)
1
Part 1: Foundations
4
Part 2: Real-World DDD
12
Part 3: Evolution Patterns

What this book covers

Chapter 1, The Rationale for Domain-Driven Design, examines how the practice of DDD provides a set of guidelines and techniques to improve the odds of success in our favor. We will look at how Eric Evans’ classic book on the subject from 2003 is extremely relevant today. We will also introduce the elements of strategic and tactical DDD.

Chapter 2, Where and How Does DDD Fit?, examines how DDD compares with several of these architecture styles and how/where it fits in the overall scheme of things when crafting a software solution.

Chapter 3, Understanding the Domain, introduces the sample domain (International Trade) at a fictitious KP bank. We also examine how we can get started with strategic design using techniques like business model canvas, impact maps, and Wardley maps.

Chapter 4, Domain Analysis and Modeling, continues the analysis and modeling of the sample problem domain – Letter of Credit (LC) application, by using techniques like domain storytelling and eventstorming to arrive at a shared understanding of the problem and brainstorm ideas to arrive at a solution.

Chapter 5, Implementing Domain Logic, implements the command-side API for the sample application. We will look at how we can employ an event-driven architecture to build loosely coupled components. We will also look at how to implement structural and business validations and persistence options by contrasting state-stored and event-sourced aggregates.

Chapter 6, Implementing the User Interface – Task-Based, designs the user interace (UI) for the sample application. We will also express expectations of the UI to the service implementation.

Chapter 7, Implementing Queries, dives deeper into how we can construct read-optimized representations of data by listening to domain events. We will also look at persistence options for these read models.

Chapter 8, Implementing Long-Running Workflows, looks at implementing both long-running user operations (sagas) and deadlines. We will also look at how we can keep track of the overall flow using log aggregation and distributed tracing. We will round off by looking at when/whether to choose explicit orchestration components of implicit choreography.

Chapter 9, Integrating with External Systems, looks at integrating with other systems and bounded contexts. We will present the various styles of integration and the implications of choosing each of these.

Chapter 10, Beginning the Decomposition Journey, decomposes the command and the query side of the sample-bounded context into distinct components. We will look at the trade-offs involved when making these choices.

Chapter 11, Decomposing into Finer-Grained Components, looks at finer-grained decomposition and the trade-offs involved beyond the technical implications. We will decompose our application into distinct functions and discuss where it might be appropriate to draw the line.

Chapter 12, Beyond Functional Requirements, looks at factors beyond business requirements that can play a significant role in how applications are decomposed. Specifically, we will examine the effect that cross-functional requirements play when applying DDD.