Implementing Domain-Driven Design

Implementing Domain-Driven Design

Read it now on the O’Reilly learning platform with a 10-day free trial.

O’Reilly members get unlimited access to books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.

Book description

“For software developers of all experience levels looking to improve their results, and design and implement domain-driven enterprise applications consistently with the best current state of professional practice, Implementing Domain-Driven Design will impart a treasure trove of knowledge hard won within the DDD and enterprise application architecture communities over the last couple decades.”

–Randy Stafford, Architect At-Large, Oracle Coherence Product Development

“This book is a must-read for anybody looking to put DDD into practice.”

–Udi Dahan, Founder of NServiceBus

Implementing Domain-Driven Design presents a top-down approach to understanding domain-driven design (DDD) in a way that fluently connects strategic patterns to fundamental tactical programming tools. Vaughn Vernon couples guided approaches to implementation with modern architectures, highlighting the importance and value of focusing on the business domain while balancing technical considerations.

Building on Eric Evans’ seminal book, Domain-Driven Design, the author presents practical DDD techniques through examples from familiar domains. Each principle is backed up by realistic Java examples–all applicable to C# developers–and all content is tied together by a single case study: the delivery of a large-scale Scrum-based SaaS system for a multitenant environment.

The author takes you far beyond “DDD-lite” approaches that embrace DDD solely as a technical toolset, and shows you how to fully leverage DDD’s “strategic design patterns” using Bounded Context, Context Maps, and the Ubiquitous Language. Using these techniques and examples, you can reduce time to market and improve quality, as you build software that is more flexible, more scalable, and more tightly aligned to business goals.

Show and hide more Table of contents Product information

Table of contents

  1. Title Page
  2. Copyright Page
  3. Praise for Implementing Domain-Driven Design
  4. Dedication Page
  5. Contents
  6. Foreword
  7. Preface
    1. Getting Grounded, Getting Airborne
    2. Landing with Domain-Driven Design
    3. Mapping the Terrain and Charting for Flight
    4. Summary of Chapters
      1. Chapter 1: Getting Started with DDD
      2. Chapter 2: Domains, Subdomains, and Bounded Contexts
      3. Chapter 3: Context Maps
      4. Chapter 4: Architecture
      5. Chapter 5: Entities
      6. Chapter 6: Value Objects
      7. Chapter 7: Services
      8. Chapter 8: Domain Events
      9. Chapter 9: Modules
      10. Chapter 10: Aggregates
      11. Chapter 11: Factories
      12. Chapter 12: Repositories
      13. Chapter 13: Integrating Bounded Contexts
      14. Chapter 14: Application
      15. Appendix A: Aggregates and Event Sourcing: A+ES
      1. Big-Picture View of DDD
        1. Strategic Modeling
        2. Architecture
        3. Tactical Modeling
        1. Can I DDD?
        2. Why You Should Do DDD
          1. Delivering Business Value Can Be Elusive
          2. How DDD Helps
          3. Grappling with the Complexity of Your Domain
          4. Anemia and Memory Loss
          1. Ubiquitous Language
          1. 1. The Organization Gains a Useful Model of Its Domain
          2. 2. A Refined, Precise Definition and Understanding of the Business Is Developed
          3. 3. Domain Experts Contribute to Software Design
          4. 4. A Better User Experience Is Gained
          5. 5. Clean Boundaries Are Placed around Pure Models
          6. 6. Enterprise Architecture Is Better Organized
          7. 7. Agile, Iterative, Continuous Modeling Is Used
          8. 8. New Tools, Both Strategic and Tactical, Are Employed
          1. Justification for Domain Modeling
          2. DDD Is Not Heavy
          1. Big Picture
            1. Subdomains and Bounded Contexts at Work
            2. Focus on the Core Domain
            1. Room for More than the Model
            2. Size of Bounded Contexts
            3. Aligning with Technical Components
            1. Collaboration Context
            2. Identity and Access Context
            3. Agile Project Management Context
            1. Why Context Maps Are So Essential
              1. Drawing Context Maps
              2. Projects and Organizational Relationships
              3. Mapping the Three Contexts
              1. Interviewing the Successful CIO
              2. Layers
                1. Dependency Inversion Principle
                1. Contributed by Stefan Tilkov
                2. REST as an Architectural Style
                3. Key Aspects of a RESTful HTTP Server
                4. Key Aspects of a RESTful HTTP Client
                5. REST and DDD
                6. Why REST?
                1. Examining Areas of CQRS
                2. Dealing with an Eventually Consistent Query Model
                1. Pipes and Filters
                2. Long-Running Processes, aka Sagas
                3. Event Sourcing
                1. Contributed by Wes Williams
                2. Data Replication
                3. Event-Driven Fabrics and Domain Events
                4. Continuous Queries
                5. Distributed Processing
                1. Why We Use Entities
                2. Unique Identity
                  1. User Provides Identity
                  2. Application Generates Identity
                  3. Persistence Mechanism Generates Identity
                  4. Another Bounded Context Assigns Identity
                  5. When the Timing of Identity Generation Matters
                  6. Surrogate Identity
                  7. Identity Stability
                  1. Uncovering Entities and Properties
                  2. Digging for Essential Behavior
                  3. Roles and Responsibilities
                  4. Construction
                  5. Validation
                  6. Change Tracking
                  1. Value Characteristics
                    1. Measures, Quantifies, or Describes
                    2. Immutable
                    3. Conceptual Whole
                    4. Replaceability
                    5. Value Equality
                    6. Side-Effect-Free Behavior
                    1. Reject Undue Influence of Data Model Leakage
                    2. ORM and Single Value Objects
                    3. ORM and Many Values Serialized into a Single Column
                    4. ORM and Many Values Backed by a Database Entity
                    5. ORM and Many Values Backed by a Join Table
                    6. ORM and Enum-as-State Objects
                    1. What a Domain Service Is (but First, What It Is Not)
                    2. Make Sure You Need a Service
                    3. Modeling a Service in the Domain
                      1. Is Separated Interface a Necessity?
                      2. A Calculation Process
                      3. Transformation Services
                      4. Using a Mini-Layer of Domain Services
                      1. The When and Why of Domain Events
                      2. Modeling Events
                        1. With Aggregate Characteristics
                        2. Identity
                        1. Publisher
                        2. Subscribers
                        1. Messaging Infrastructure Consistency
                        2. Autonomous Services and Systems
                        3. Latency Tolerances
                        1. Publishing Notifications as RESTful Resources
                        2. Publishing Notifications through Messaging Middleware
                        1. Publishing the NotificationLog
                        2. Publishing Message-Based Notifications
                        1. Designing with Modules
                        2. Basic Module Naming Conventions
                        3. Module Naming Conventions for the Model
                        4. Modules of the Agile Project Management Context
                        5. Modules in Other Layers
                        6. Module before Bounded Context
                        7. Wrap-Up
                        1. Using Aggregates in the Scrum Core Domain
                          1. First Attempt: Large-Cluster Aggregate
                          2. Second Attempt: Multiple Aggregates
                          1. Don’t Trust Every Use Case
                          1. Making Aggregates Work Together through Identity References
                          2. Model Navigation
                          3. Scalability and Distribution
                          1. Ask Whose Job It Is
                          1. Reason One: User Interface Convenience
                          2. Reason Two: Lack of Technical Mechanisms
                          3. Reason Three: Global Transactions
                          4. Reason Four: Query Performance
                          5. Adhering to the Rules
                          1. Rethinking the Design, Again
                          2. Estimating Aggregate Cost
                          3. Common Usage Scenarios
                          4. Memory Consumption
                          5. Exploring Another Alternative Design
                          6. Implementing Eventual Consistency
                          7. Is It the Team Member’s Job?
                          8. Time for Decisions
                          1. Create a Root Entity with Unique Identity
                          2. Favor Value Object Parts
                          3. Using Law of Demeter and Tell, Don’t Ask
                          4. Optimistic Concurrency
                          5. Avoid Dependency Injection
                          1. Factories in the Domain Model
                          2. Factory Method on Aggregate Root
                            1. Creating CalendarEntry Instances
                            2. Creating Discussion Instances
                            1. Collection-Oriented Repositories
                              1. Hibernate Implementation
                              2. Considerations for a TopLink Implementation
                              1. Coherence Implementation
                              2. MongoDB Implementation
                              1. A Warning
                              1. Testing with In-Memory Implementations
                              1. Integration Basics
                                1. Distributed Systems Are Fundamentally Different
                                2. Exchanging Information across System Boundaries
                                1. Implementing the RESTful Resource
                                2. Implementing the REST Client Using an Anticorruption Layer
                                1. Staying Informed about Product Owners and Team Members
                                2. Can You Handle the Responsibility?
                                3. Long-Running Processes, and Avoiding Responsibility
                                4. Process State Machines and Time-out Trackers
                                5. Designing a More Sophisticated Process
                                6. When Messaging or Your System Is Unavailable
                                1. User Interface
                                  1. Rendering Domain Objects
                                  2. Render Data Transfer Object from Aggregate Instances
                                  3. Use a Mediator to Publish Aggregate Internal State
                                  4. Render Aggregate Instances from a Domain Payload Object
                                  5. State Representations of Aggregate Instances
                                  6. Use Case Optimal Repository Queries
                                  7. Dealing with Multiple, Disparate Clients
                                  8. Rendition Adapters and Handling User Edits
                                  1. Sample Application Service
                                  2. Decoupled Service Output
                                  1. Inside an Application Service
                                  2. Command Handlers
                                  3. Lambda Syntax
                                  4. Concurrency Control
                                  5. Structural Freedom with A+ES
                                  6. Performance
                                  7. Implementing an Event Store
                                  8. Relational Persistence
                                  9. BLOB Persistence
                                  10. Focused Aggregates
                                  11. Read Model Projections
                                  12. Use with Aggregate Design
                                  13. Events Enrichment
                                  14. Supporting Tools and Patterns
                                    1. Event Serializers
                                    2. Event Immutability
                                    3. Value Objects
                                    Show and hide more

                                    Product information

                                    • Title: Implementing Domain-Driven Design
                                    • Author(s):
                                    • Release date: February 2013
                                    • Publisher(s): Addison-Wesley Professional
                                    • ISBN: 9780133039900