Learning Domain-Driven Design: Aligning Software Architecture and Business Strategy
Building software is harder than ever. As a developer, you not only have to chase ever-changing technological trends but you also need to understand the business domains behind the software. This practical book provides you with a set of core patterns, principles, and practices for analyzing business domains, understanding business strategy, and, most importantly, aligning software design with its business needs.
Author Vladik Khononov shows you how these practices lead to robust implementation of business logic and help to future-proof software design and architecture. You’ll examine the relationship between DDD and other methodologies to ensure you make architectural decisions that meet business requirements. You’ll also explore the real-life story of implementing DDD in a startup company.
With this book, you’ll learn how to:
- Use DDD’s strategic patterns and practices as well as its tactical patterns and use cases
- Analyze a client company’s business domain and competitive strategy
- Build a shared understanding of the business domains you encounter
- Decompose a system into bounded contexts
- Coordinate the work of multiple teams working together
- Gradually start implementing domain-driven design
Foreword Preface Why I Wrote This Book Who Should Read This Book Navigating the Book Example Domain: WolfDesk Conventions Used in This Book Using Code Examples O’Reilly Online Learning How to Contact Us Acknowledgments Introduction I. Strategic Design 1. Analyzing Business Domains What Is a Business Domain? What Is a Subdomain? Types of Subdomains Comparing Subdomains Identifying Subdomain Boundaries Domain Analysis Examples Gigmaster BusVNext Who Are the Domain Experts? Conclusion Exercises 2. Discovering Domain Knowledge Business Problems Knowledge Discovery Communication What Is a Ubiquitous Language? Language of the Business Scenarios Consistency Model of the Business Domain What Is a Model? Effective Modeling Modeling the Business Domain Continuous Effort Tools Challenges Conclusion Exercises 3. Managing Domain Complexity Inconsistent Models What Is a Bounded Context? Model Boundaries Ubiquitous Language Refined Scope of a Bounded Context Bounded Contexts Versus Subdomains Subdomains Bounded Contexts The Interplay Between Subdomains and Bounded Contexts Boundaries Physical Boundaries Ownership Boundaries Bounded Contexts in Real Life Semantic Domains Science Buying a Refrigerator Conclusion Exercises 4. Integrating Bounded Contexts Cooperation Partnership Shared Kernel Customer–Supplier Conformist Anticorruption Layer Open-Host Service Separate Ways Communication Issues Generic Subdomains Model Differences Context Map Maintenance Limitations Conclusion Exercises II. Tactical Design 5. Implementing Simple Business Logic Transaction Script Implementation It’s Not That Easy! When to Use Transaction Script Active Record Implementation When to Use Active Record Be Pragmatic Conclusion Exercises 6. Tackling Complex Business Logic History Domain Model Implementation Building Blocks Managing Complexity Conclusion Exercises 7. Modeling the Dimension of Time Event Sourcing Search Analysis Source of Truth Event Store Event-Sourced Domain Model Advantages Disadvantages Frequently Asked Questions Performance Deleting Data Why Can’t I Just…? Conclusion Exercises 8. Architectural Patterns Business Logic Versus Architectural Patterns Layered Architecture Presentation Layer Business Logic Layer Data Access Layer Communication Between Layers Variation When to Use Layered Architecture Ports & Adapters Terminology Dependency Inversion Principle Integration of Infrastructural Components Variants When to Use Ports & Adapters Command-Query Responsibility Segregation Polyglot Modeling Implementation Projecting Read Models Challenges Model Segregation When to Use CQRS Scope Conclusion Exercises 9. Communication Patterns Model Translation Stateless Model Translation Stateful Model Translation Integrating Aggregates Outbox Saga Process Manager Conclusion Exercises III. Applying Domain-Driven Design in Practice 10. Design Heuristics Heuristic Bounded Contexts Business Logic Implementation Patterns Architectural Patterns Testing Strategy Testing Pyramid Testing Diamond Reversed Testing Pyramid Tactical Design Decision Tree Conclusion Exercises 11. Evolving Design Decisions Changes in Domains Core to Generic Generic to Core Supporting to Generic Supporting to Core Core to Supporting Generic to Supporting Strategic Design Concerns Tactical Design Concerns Transaction Script to Active Record Active Record to Domain Model Domain Model to Event-Sourced Domain Model Generating Past Transitions Modeling Migration Events Organizational Changes Partnership to Customer–Supplier Customer–Supplier to Separate Ways Domain Knowledge Growth Subdomains Bounded Contexts Aggregates Conclusion Exercises 12. EventStorming What Is EventStorming? Who Should Participate in EventStorming? What Do You Need for EventStorming? The EventStorming Process Step 1: Unstructured Exploration Step 2: Timelines Step 3: Pain Points Step 4: Pivotal Events Step 5: Commands Step 6: Policies Step 7: Read Models Step 8: External Systems Step 9: Aggregates Step 10: Bounded Contexts Variants When to Use EventStorming Facilitation Tips Watch the Dynamics Remote EventStorming Conclusion Exercises 13. Domain-Driven Design in the Real World Strategic Analysis Understand the Business Domain Explore the Current Design Modernization Strategy Strategic Modernization Tactical Modernization Cultivate a Ubiquitous Language Pragmatic Domain-Driven Design Selling Domain-Driven Design Undercover Domain-Driven Design Conclusion Exercises IV. Relationships to Other Methodologies and Patterns 14. Microservices What Is a Service? What Is a Microservice? Method as a Service: Perfect Microservices? Design Goal System Complexity Microservices as Deep Services Microservices as Deep Modules Domain-Driven Design and Microservices’ Boundaries Bounded Contexts Aggregates Subdomains Compressing Microservices’ Public Interfaces Open-Host Service Anticorruption Layer Conclusion Exercises 15. Event-Driven Architecture Event-Driven Architecture Events Events, Commands, and Messages Structure Types of Events Designing Event-Driven Integration Distributed Big Ball of Mud Temporal Coupling Functional Coupling Implementation Coupling Refactoring the Event-Driven Integration Event-Driven Design Heuristics Conclusion Exercises 16. Data Mesh Analytical Data Model Versus Transactional Data Model Fact Table Dimension Table Analytical Models Analytical Data Management Platforms Data Warehouse Data Lake Challenges of Data Warehouse and Data Lake Architectures Data Mesh Decompose Data Around Domains Data as a Product Enable Autonomy Build an Ecosystem Combining Data Mesh and Domain-Driven Design Conclusion Exercises Closing Words Problem Solution Implementation Further Reading Advanced Domain-Driven Design Architectural and Integration Patterns Modernization of Legacy Systems EventStorming Conclusion A. Applying DDD: A Case Study Five Bounded Contexts Business Domain Bounded Context #1: Marketing Bounded Context #2: CRM Bounded Context #3: Event Crunchers Bounded Context #4: Bonuses Bounded Context #5: The Marketing Hub Discussion Ubiquitous Language Subdomains Boundaries of Bounded Contexts Conclusion B. Answers to Exercise Questions Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Chapter 15 Chapter 16 References Index
How to download source code?
1. Go to:
2. Search the book title:
Learning Domain-Driven Design: Aligning Software Architecture and Business Strategy, sometime you may not get the results, please search the main title
3. Click the book title in the search results
Publisher resources section, click
Download Example Code.
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.