Domain-Driven Design: Tackling Complexity in the Heart of Software (Hardcover)
暫譯: 領域驅動設計:應對軟體核心的複雜性 (精裝版)

Eric Evans

買這商品的人也買了...

相關主題

商品描述

The software development community widely acknowledges that domain modeling is central to software design. Through domain modeling, software developers are able to express rich functionality and translate that functionality into software implementation that truly serves the needs of its users. Despite its obvious importance, however, there are few practical resources that show how to incorporate effective domain modeling into the software development process.

Domain-Driven Design fills that need. It offers readers a systematic approach to domain-driven design, presenting an extensive set of design best practices, experience-based techniques, and fundamental principles that facilitate the development of software projects facing complex domains. Intertwining design and development practice, Domain-Driven Design incorporates numerous examples in Java-case studies taken from actual projects that illustrate the application of domain-driven design to real-world software development.

Readers will find an overview of domain-driven design that highlights key principles, terms, and implications. The book presents a core of best practices and standard patterns that provide a common language for the development team. In addition, it highlights how refactoring in domain modeling, integrated with the frequent iterations of Agile development, leads to deeper insight into domains and enhanced communication between domain expert and programmer. Building on this foundation, the book then addresses domain-driven design for complex systems and larger organizations.

Specific topics covered include:

  • Isolating the domain
  • Entities, value objects, services, and modules
  • The lifecycle of a domain object
  • Representing processes as domain objects
  • Creating functions free of side effects
  • Conceptual contours
  • Standalone classes
  • Extending specifications
  • Applying analysis patterns
  • Relating design patterns to the model
  • Maintaining model integrity
  • Formulating the domain vision statement
  • Choosing refactoring targets
  • Responsibility layers
  • Creating a pluggable component framework
  • Bringing together large-scale structures and bounded contexts

With this book in hand, object-oriented developers, system analysts, and designers will have the guidance they need to think deeply about domains, create rich and accurate domain models, and transform these models into high-quality, long-lasting software implementations.

Table of Contents

Foreword.


Preface.


Acknowledgments.

I. PUTTING THE DOMAIN MODEL TO WORK.

1. Crunching Knowledge.

 

Ingredients of Effective Modeling.

 

 

Knowledge Crunching.

 

 

Continuous Learning.

 

 

Knowledge-Rich Design.

 

 

Deep Models.

 

2. Communication and the Use of Language.

 

UBIQUITOUS LANGUAGE.

 

 

Modeling Out Loud.

 

 

One Team, One Language.

 

 

Documents and Diagrams.

 

 

Written Design Documents.

 

 

Executable Bedrock.

 

 

Explanatory Models.

 

3. Binding Model and Implementation.

 

MODEL-DRIVEN DESIGN.

 

 

Modeling Paradigms and Tool Support.

 

 

Letting the Bones Show: Why Models Matter to Users.

 

 

HANDS-ON MODELERS.

 

II. THE BUILDING BLOCKS OF A MODEL-DRIVEN DESIGN.

4. Isolating the Domain.

 

LAYERED ARCHITECTURE.

 

 

Relating the Layers.

 

 

Architectural Frameworks.

 

 

The Domain Layer Is Where the Model Lives.

 

 

THE SMART UI “ANTI-PATTERN”

 

 

Other Kinds of Isolation.

 

5. A Model Expressed in Software.

 

Associations.

 

 

ENTITIES (A.K.A. REFERENCE OBJECTS).

 

 

Modeling ENTITIES.

 

 

Designing the Identity Operation.

 

 

VALUE OBJECTS.

 

 

Designing VALUE OBJECTS.

 

 

Designing Associations That Involve VALUE OBJECTS.

 

 

SERVICES.

 

 

SERVICES and the Isolated Domain Layer.

 

 

Granularity.

 

 

Access to SERVICES.

 

 

MODULES (A.K.A. PACKAGES).

 

 

Agile MODULES.

 

 

The Pitfalls of Infrastructure-Driven Packaging.

 

 

Modeling Paradigms.

 

 

Why the Object Paradigm Predominates.

 

 

Nonobjects in an Object World.

 

 

Sticking with MODEL-DRIVEN DESIGN When Mixing Paradigms.

 

6. The Life Cycle of a Domain Object.

 

AGGREGATES.

 

 

FACTORIES.

 

 

Choosing FACTORIES and Their Sites.

 

 

When a Constructor Is All You Need.

 

 

Designing the Interface.

 

 

Where Does Invariant Logic Go?

 

 

ENTITY FACTORIES Versus VALUE OBJECT FACTORIES.

 

 

Reconstituting Stored Objects.

 

 

REPOSITORIES.

 

 

Querying a REPOSITORY.

 

 

Client Code Ignores REPOSITORY Implementation; Developers Do Not.

 

 

Implementing a REPOSITORY.

 

 

Working Within Your Frameworks.

 

 

The Relationship with FACTORIES.

 

 

Designing Objects for Relational Databases.

 

7. Using the Language: An Extended Example.

 

Introducing the Cargo Shipping System.

 

 

Isolating the Domain: Introducing the Applications.

 

 

Distinguishing ENTITIES and VALUE OBJECTS.

 

 

Role and Other Attributes.

 

 

Designing Associations in the Shipping Domain.

 

 

AGGREGATE Boundaries.

 

 

Selecting REPOSITORIES.

 

 

Walking Through Scenarios.

 

 

Sample Application Feature: Changing the Destination of a Cargo.

 

 

Sample Application Feature: Repeat Business.

 

 

Object Creation.

 

 

FACTORIES and Constructors for Cargo.

 

 

Adding a Handling Event.

 

 

Pause for Refactoring: An Alternative Design of the Cargo AGGREGATE.

 

 

MODULES in the Shipping Model.

 

 

Introducing a New Feature: Allocation Checking.

 

 

Connecting the Two Systems.

 

 

Enhancing the Model: Segmenting the Business.

 

 

Performance Tuning.

 

 

A Final Look.

 

III. REFACTORING TOWARD DEEPER INSIGHT.

8. Breakthrough.

 

Story of a Breakthrough.

 

 

A Decent Model, and Yet….

 

 

The Breakthrough.

 

 

A Deeper Model.

 

 

A Sobering Decision.

 

 

The Payoff.

 

 

Opportunities.

 

 

Focus on Basics.

 

 

Epilogue: A Cascade of New Insights.

 

9. Making Implicit Concepts Explicit.

 

Digging Out Concepts.

 

 

Listen to Language.

 

 

Scrutinize Awkwardness.

 

 

Contemplate Contradictions.

 

 

Read the Book.

 

 

Try, Try Again.

 

 

How to Model Less Obvious Kinds of Concepts.

 

 

Explicit Constraints.

 

 

Processes as Domain Objects.

 

 

SPECIFICATION

 

 

Applying and Implementing SPECIFICATION.

 

10. Supple Design.

 

INTENTION-REVEALING INTERFACES.

 

 

SIDE-EFFECT-FREE FUNCTIONS.

 

 

ASSERTIONS.

 

 

CONCEPTUAL CONTOURS.

 

 

STANDALONE CLASSES.

 

 

CLOSURE OF OPERATIONS.

 

 

DECLARATIVE DESIGN.

 

 

Domain-Specific Languages.

 

 

A Declarative Style of Design.

 

 

Extending SPECIFICATIONS in a Declarative Style.

 

 

Angles of Attack.

 

 

Carve Off Subdomains.

 

 

Draw on Established Formalisms, When You Can.

 

11. Applying Analysis Patterns.
 
12. Relating Design Patterns to the Model.

 

STRATEGY (A.K.A. POLICY).

 

 

COMPOSITE.

 

 

Why Not FLYWEIGHT?

 

13. Refactoring Toward Deeper Insight.

 

Initiation.

 

 

Exploration Teams.

 

 

Prior Art.

 

 

A Design for Developers.

 

 

Timing.

 

 

Crisis as Opportunity.

 

IV. STRATEGIC DESIGN.

14. Maintaining Model Integrity.

 

BOUNDED CONTEXT.

 

 

Recognizing Splinters Within a BOUNDED CONTEXT

 

 

CONTINUOUS INTEGRATION.

 

 

CONTEXT MAP.

 

 

Testing at the CONTEXT Boundaries.

 

 

Organizing and Documenting CONTEXT MAPS.

 

 

Relationships Between BOUNDED CONTEXTS.

 

 

SHARED KERNEL.

 

 

CUSTOMER/SUPPLIER DEVELOPMENT TEAMS.

 

 

CONFORMIST.

 

 

ANTICORRUPTION LAYER.

 

 

Designing the Interface of the ANTICORRUPTION LAYER.

 

 

Implementing the ANTICORRUPTION LAYER.

 

 

A Cautionary Tale.

 

 

SEPARATE WAYS.

 

 

OPEN HOST SERVICE.

 

 

PUBLISHED LANGUAGE.

 

 

Unifying an Elephant.

 

 

Choosing Your Model Context Strategy.

 

 

Team Decision or Higher.

 

 

Putting Ourselves in Context.

 

 

Transforming Boundaries.

 

 

Accepting That Which We Cannot Change: Delineating the External Systems.

 

 

Relationships with the External Systems.

 

 

The System Under Design.

 

 

Catering to Special Needs with Distinct Models.

 

 

Deployment.

 

 

The Trade-off.

 

 

When Your Project Is Already Under Way.

 

 

Transformations.

 

 

Merging CONTEXTS: SEPARATE WAYS—SHARED KERNEL.

 

 

Merging CONTEXTS: SHARED KERNEL—CONTINUOUS INTEGRATION.

 

 

Phasing Out a Legacy System.

 

 

OPEN HOST SERVICE—PUBLISHED LANGUAGE.

 

15. Distillation.

 

CORE DOMAIN.

 

 

Choosing the CORE.

 

 

Who Does the Work?

 

 

An Escalation of Distillations.

 

 

GENERIC SUBDOMAINS.

 

 

Generic Doesn't Mean Reusable.

 

 

Project Risk Management.

 

 

DOMAIN VISION STATEMENT.

 

 

HIGHLIGHTED CORE.

 

 

The Distillation Document.

 

 

The Flagged CORE.

 

 

The Distillation Document as Process Tool.

 

 

COHESIVE MECHANISMS.

 

 

GENERIC SUBDOMAIN Versus COHESIVE MECHANISM.

 

 

When a MECHANISM Is Part of the CORE DOMAIN.

 

 

Distilling to a Declarative Style.

 

 

SEGREGATED CORE.

 

 

The Costs of Creating a SEGREGATED CORE.

 

 

Evolving Team Decision.

 

 

ABSTRACT CORE.

 

 

Deep Models Distill.

 

 

Choosing Refactoring Targets.

 

16. Large-Scale Structure.

 

EVOLVING ORDER.

 

 

SYSTEM METAPHOR.

 

 

The “Naive Metaphor” and Why We Don't Need It.

 

 

RESPONSIBILITY LAYERS.

 

 

Choosing Appropriate Layers.

 

 

KNOWLEDGE LEVEL.

 

 

PLUGGABLE COMPONENT FRAMEWORK.

 

 

How Restrictive Should a Structure Be?

 

 

Refactoring Toward a Fitting Structure.

 

 

Minimalism.

 

 

Communication and Self-Discipline.

 

 

Restructuring Yields Supple Design.

 

 

Distillation Lightens the Load.

 

17. Bringing the Strategy Together.

 

Combining Large-Scale Structures and BOUNDED CONTEXTS.

 

 

Combining Large-Scale Structures and Distillation.

 

 

Assessment First.

 

 

Who Sets the Strategy?

 

 

Emergent Structure from Application Development.

 

 

A Customer-Focused Architecture Team.

 

 

Six Essentials for Strategic Design Decision Making.

 

 

The Same Goes for the Technical Frameworks.

 

 

Beware the Master Plan.

 

Conclusion.
Appendix: The Use of Patterns in This Book.
Glossary.
References.
Photo Credits.
Index.

商品描述(中文翻譯)

軟體開發社群廣泛認同領域建模是軟體設計的核心。透過領域建模,軟體開發人員能夠表達豐富的功能,並將這些功能轉化為真正滿足使用者需求的軟體實現。儘管其重要性顯而易見,但卻缺乏實用資源來展示如何將有效的領域建模納入軟體開發過程中。

《領域驅動設計》滿足了這一需求。它為讀者提供了一種系統化的領域驅動設計方法,呈現了一套廣泛的設計最佳實踐、基於經驗的技術和基本原則,這些都能促進面對複雜領域的軟體專案開發。《領域驅動設計》將設計與開發實踐交織在一起,包含了許多來自實際專案的 Java 案例研究,這些案例展示了領域驅動設計在現實世界軟體開發中的應用。

讀者將會找到一個關於領域驅動設計的概述,突顯出關鍵原則、術語和含義。本書呈現了一系列最佳實踐和標準模式,為開發團隊提供了共同語言。此外,它強調了在領域建模中的重構,與敏捷開發的頻繁迭代相結合,如何導致對領域的更深刻理解以及領域專家與程式設計師之間的增強溝通。在此基礎上,本書接著探討了複雜系統和大型組織的領域驅動設計。

具體涵蓋的主題包括:

- 隔離領域
- 實體、值物件、服務和模組
- 領域物件的生命週期
- 將過程表示為領域物件
- 創建無副作用的函數
- 概念輪廓
- 獨立類別
- 擴展規範
- 應用分析模式
- 將設計模式與模型相關聯
- 維護模型完整性
- 制定領域願景聲明
- 選擇重構目標
- 責任層
- 創建可插拔的元件框架
- 將大規模結構與界限上下文結合

有了這本書,面向物件的開發人員、系統分析師和設計師將能夠獲得深入思考領域的指導,創建豐富且準確的領域模型,並將這些模型轉化為高品質、持久的軟體實現。

目錄

前言

序言

致謝

I. 將領域模型付諸實踐

1. 知識的整合

有效建模的要素

知識整合

持續學習

知識豐富的設計

深度模型

2. 溝通與語言的使用

普遍語言

大聲建模

一個團隊,一種語言

文件與圖表

書面設計文件

可執行的基石

解釋性模型

3. 綁定模型與實現

模型驅動設計

建模範式與工具支援

讓骨架顯露:為什麼模型對使用者重要

實作模型者

II. 模型驅動設計的基石

4. 隔離領域

分層架構

層之間的關聯

架構框架

領域層是模型所在之處

聰明的 UI “反模式”

其他類型的隔離

5. 用軟體表達模型

關聯

實體(又稱參考物件)

建模實體

設計身份操作

值物件

設計值物件

設計涉及值物件的關聯

服務

服務與隔離的領域層

粒度

訪問服務

模組(又稱包)

敏捷模組

基於基礎設施的包裝陷阱

建模範式

為什麼物件範式佔主導地位

物件世界中的非物件

在混合範式時堅持模型驅動設計

6. 領域物件的生命週期

聚合

工廠

選擇工廠及其位置

當構造函數是你所需的一切

設計介面

不變邏輯的去處

實體工廠與值物件工廠

重建儲存物件

倉儲

查詢倉儲

客戶端代碼忽略倉儲實現;開發者則不會

實作倉儲

在你的框架內工作

與工廠的關係

為關聯資料庫設計物件

7. 使用語言:擴展範例

介紹貨物運輸系統

隔離領域:介紹應用程式

區分實體與值物件

角色及其他屬性

設計運輸領域的關聯

聚合邊界

選擇倉儲

逐步走過場景

範例應用功能:改變貨物的目的地

範例應用功能:重複業務

物件創建

貨物的工廠與構造函數

添加處理事件

重構的暫停:貨物聚合的替代設計

運輸模型中的模組

介紹新功能:分配檢查

連接兩個系統

增強模型:細分業務

性能調整

最後的回顧

III. 重構以獲得更深的洞察

8. 突破

突破的故事

一個不錯的模型,然而……

突破