目 錄 Part I Putting the Domain Model to Work / 運用領域模型 1 Chapter 1: Crunching Knowledge / 消化知識 7 Ingredients of Effective Modeling / 有效建模的要素 12 Knowledge Crunching / 知識消化 13 Continuous Learning / 持續(xù)學習 15 Knowledge-Rich Design / 知識豐富的設計 17 Deep Models / 深層模型 20 Chapter 2: Communication and the Use of Language / 交流與語言的使用 23 UBIQUITOUS LANGUAGE 24 Modeling Out Loud /“大聲地”建模 30 One Team, One Language / 一個團隊,一種語言 32 Documents and Diagrams / 文檔和圖 35 Written Design Documents / 書面設計文檔 37 Executable Bedrock / 完全依賴可執(zhí)行代碼的情況 40 Explanatory Models / 解釋性模型 41 Chapter 3: Binding Model and Implementation / 綁定模型和實現(xiàn) 45 MODEL-DRIVEN DESIGN 47 Modeling Paradigms and Tool Support / 建模范式和工具支持 50 Letting the Bones Show: Why Models Matter to Users / 揭示主旨:為什么模型對用戶至關重要 57 HANDS-ON MODELERS 60 Part II The Building Blocks of a Model-Driven Design / 模型驅動設計的構造塊 63 Chapter 4: Isolating the Domain / 分離領域 67 LAYERED ARCHITECTURE 68 Relating the Layers / 將各層關聯(lián)起來 72 Architectural Frameworks / 架構框架 74 The Domain Layer Is Where the Model Lives / 領域層是模型的精髓 75 THE SMART UI “ANTI-PATTERN” / THE SMART UI“反模式” 76 Other Kinds of Isolation / 其他分離方式 79 Chapter 5: A Model Expressed in Software / 軟件中所表示的模型 81 Associations / 關聯(lián) 82 ENTITIES(A.K.A. REFERENCE OBJECTS)/ ENTITY(也稱為REFERENCE OBJECT) 89 Modeling ENTITIES / ENTITY建?!?3 Designing the Identity Operation / 設計標識操作 94 VALUE OBJECTS 97 Designing VALUE OBJECTS / 設計VALUE OBJECT 99 Designing Associations That Involve VALUE OBJECTS / 設計包含VALUE OBJECT的關聯(lián) 102 SERVICES 104 SERVICES and the Isolated Domain Layer / SERVICE與孤立的領域層 106 Granularity / 粒度 108 Access to SERVICES / 對SERVICE的訪問 108 MODULES(A.K.A. PACKAGES)/ MODULE(也稱為PACKAGE) 109 Agile MODULES / 敏捷的MODULE 111 The Pitfalls of Infrastructure-Driven Packaging / 通過基礎設施打包時存在的隱患 112 Modeling Paradigms / 建模范式 116 Why the Object Paradigm Predominates / 對象范式流行的原因 116 Nonobjects in an Object World / 對象世界中的非對象 119 Sticking with MODEL-DRIVEN DESIGN When Mixing Paradigms /在混合范式中堅持使用MODEL-DRIVEN DESIGN 120 Chapter 6: The Life Cycle of a Domain Object / 領域對象的生命周期 123 AGGREGATES 125 FACTORIES 136 Choosing FACTORIES and Their Sites / 選擇FACTORY及其應用位置 139 When a Constructor Is All You Need / 有些情況下只需使用構造函數(shù) 141 Designing the Interface / 接口的設計 143 Where Does Invariant Logic Go / 固定規(guī)則的相關邏輯應放置在哪里 144 ENTITY FACTORIES Versus VALUE OBJECT FACTORIES / ENTITY FACTORY與VALUE OBJECT FACTORY 144 Reconstituting Stored Objects / 重建已存儲的對象 145 REPOSITORIES 147 Querying a REPOSITORY / REPOSITORY的查詢 152 Client Code Ignores REPOSITORY Implementation; Developers Do Not / 客戶代碼可以忽略REPOSITORY的實現(xiàn),但開發(fā)人員不能忽略 154 Implementing a REPOSITORY / REPOSITORY的實現(xiàn) 155 Working Within Your Frameworks / 在框架內(nèi)工作 156 The Relationship with FACTORIES / 與FACTORY的關系 157 Designing Objects for Relational Databases / 為關系數(shù)據(jù)庫設計對象 159 Chapter 7: Using the Language: An Extended Example / 使用語言:一個擴展的示例 163 Introducing the Cargo Shipping System / 貨物運輸系統(tǒng)簡介 163 Isolating the Domain: Introducing the Applications / 隔離領域:引入應用層 166 Distinguishing ENTITIES and VALUE OBJECTS / 將ENTITY和VALUE OBJECT區(qū)別開 167 Designing Associations in the Shipping Domain / 設計運輸領域中的關聯(lián) 169 AGGREGATE Boundaries / AGGREGATE邊界 170 Selecting REPOSITORIES / 選擇REPOSITORY 172 Walking Through Scenarios / 場景走查 173 Sample Application Feature: Changing the Destination of a Cargo / 應用程序特性舉例:更改Cargo的目的地 173 Sample Application Feature: Repeat Business / 應用程序特性舉例:重復業(yè)務 173 Object Creation / 對象的創(chuàng)建 174 FACTORIES and Constructors for Cargo / Cargo的FACTORY和構造函數(shù) 174 Adding a Handling Event / 添加Handling Event 175 Pause for Refactoring: An Alternative Design of the Cargo AGGREGATE / 停一下,重構:Cargo AGGREGATE 的另一種設計 177 MODULES in the Shipping Model / 運輸模型中的MODULE 179 Introducing a New Feature: Allocation Checking / 引入新特性:配額檢查 181 Connecting the Two Systems / 連接兩個系統(tǒng) 182 Enhancing the Model: Segmenting the Business / 進一步完善模型:劃分業(yè)務 183 Performance Tuning / 性能優(yōu)化 185 A Final Look / 小結 186 Part III Refactoring Toward Deeper Insight / 通過重構來加深理解 187 Chapter 8: Breakthrough / 突破 193 Story of a Breakthrough / 一個關于突破的故事 194 A Decent Model, and Yet . . . / 華而不實的模型 194 The Breakthrough / 突破 196 A Deeper Model / 更深層模型 198 A Sobering Decision / 冷靜決策 199 The Payoff / 成果 200 Opportunities / 機遇 201 Focus on Basics / 關注根本 201 Epilogue: A Cascade of New Insights / 后記:越來越多的新理解 202 Chapter 9: Making Implicit Concepts Explicit / 將隱式概念轉變?yōu)轱@式概念 205 Digging Out Concepts / 概念挖掘 206 Listen to Language / 傾聽語言 206 Scrutinize Awkwardness / 檢查不足之處 210 Contemplate Contradictions / 思考矛盾之處 216 Read the Book / 查閱書籍 217 Try, Try Again / 嘗試,再嘗試 219 How to Model Less Obvious Kinds of Concepts / 如何為那些不太明顯的概念建?!?19 Explicit Constraints / 顯式的約束 220 Processes as Domain Objects / 將過程建模為領域對象 222 SPECIFICATION 224 Applying and Implementing SPECIFICATION / SPECIFICATION的應用和實現(xiàn) 227 Chapter 10: Supple Design / 柔性設計 243 INTENTION-REVEALING INTERFACES 246 SIDE-EFFECT-FREE FUNCTIONS 250 ASSERTIONS 255 CONCEPTUAL CONTOURS 260 STANDALONE CLASSES 265 CLOSURE OF OPERATIONS 268 Declarative Design / 聲明式設計 270 A Declarative Style of Design / 聲明式設計風格 273 Angles of Attack / 切入問題的角度 282 Carve Off Subdomains / 分割子領域 283 Draw on Established Formalisms, When You Can / 盡可能利用已有的形式 283 Chapter 11: Applying Analysis Patterns / 應用分析模式 293 Chapter 12: Relating Design Patterns to the Model / 將設計模式應用于模型 309 STRATEGY (A.K.A. POLICY) / STRATEGY(也稱為POLICY) 311 COMPOSITE 315 Why Not FLYWEIGHT / 為什么沒有介紹FLYWEIGHT 320 Chapter 13: Refactoring Toward Deeper Insight / 通過重構得到更深層的理解 321 Initiation / 開始重構 321 Exploration Teams / 探索團隊 322 Prior Art / 借鑒先前的經(jīng)驗 323 A Design for Developers / 針對開發(fā)人員的設計 324 Timing / 重構的時機 324 Crisis as Opportunity / 危機就是機遇 325 Part IV Strategic Design / 戰(zhàn)略設計 327 Chapter 14: Maintaining Model Integrity / 保持模型的完整性 331 BOUNDED CONTEXT 335 CONTINUOUS INTEGRATION 341 CONTEXT MAP 344 Testing at the CONTEXT Boundaries / 測試CONTEXT的邊界 351 Organizing and Documenting CONTEXT MAPS / CONTEXT MAP的組織和文檔化 351 Relationships Between BOUNDED CONTEXTS / BOUNDED CONTEXT之間的關系 352 SHARED KERNEL 354 CUSTOMER/SUPPLIER DEVELOPMENT TEAMS 356 CONFORMIST 361 ANTICORRUPTION LAYER 364 Designing the Interface of the ANTICORRUPTION LAYER / 設計ANTICORRUPTION LAYER的接口 366 Implementing the ANTICORRUPTION LAYER / 實現(xiàn)ANTICORRUPTION LAYER 366 A Cautionary Tale / 一個關于防御的故事 370 SEPARATE WAYS 371 OPEN HOST SERVICE 374 PUBLISHED LANGUAGE 375 Unifying an Elephant /“大象”的統(tǒng)一 378 Choosing Your Model Context Strategy / 選擇你的模型上下文策略 381 Team Decision or Higher / 團隊決策或更高層決策 382 Putting Ourselves in Context / 置身上下文中 382 Transforming Boundaries / 轉換邊界 382 Accepting That Which We Cannot Change: Delineating the External Systems / 接受那些我們無法更改的事物:描述外部系統(tǒng) 383 Relationships with the External Systems / 與外部系統(tǒng)的關系 384 The System Under Design / 設計中的系統(tǒng) 385 Catering to Special Needs with Distinct Models / 用不同模型滿足特殊需要 386 Deployment / 部署 387 The Trade-off / 權衡 388 When Your Project Is Already Under Way / 當項目正在進行時 388 Transformations / 轉換 389 Merging CONTEXTS: SEPARATE WAYS SHARED KERNEL / 合并CONTEXT:SEPARATE WAY → SHARED KERNEL 389 Merging CONTEXTS: SHARED KERNEL CONTINUOUS INTEGRATION / 合并CONTEXT:SHARED KERNEL → CONTINUOUS INTEGRATION 391 Phasing Out a Legacy System / 逐步淘汰遺留系統(tǒng) 393 OPEN HOST SERVICE → PUBLISHED LANGUAGE 394 Chapter 15: Distillation / 精煉 397 CORE DOMAIN 400 Choosing the CORE / 選擇CORE 402 Who Does the Work / 工作的分配 403 An Escalation of Distillations / 精煉的逐步提升 404 GENERIC SUBDOMAINS 406 Generic Doesn’t Mean Reusable / 通用不等于可重用 412 Project Risk Management / 項目風險管理 413 DOMAIN VISION STATEMENT 415 HIGHLIGHTED CORE 417 The Distillation Document / 精煉文檔 418 The Flagged CORE / 標明CORE 419 The Distillation Document as Process Tool / 把精煉文檔作為過程工具 420 COHESIVE MECHANISMS 422 GENERIC SUBDOMAIN Versus COHESIVE MECHANISM / GENERIC SUBDOMAIN與COHESIVE MECHANISM的比較 424 When a MECHANISM Is Part of the CORE DOMAIN / MECHANISM是CORE DOMAIN一部分 425 Distilling to a Declarative Style / 通過精煉得到聲明式風格 426 SEGREGATED CORE 428 The Costs of Creating a SEGREGATED CORE / 創(chuàng)建SEGREGATED CORE的代價 429 Evolving Team Decision / 不斷發(fā)展演變的團隊決策 430 ABSTRACT CORE 435 Deep Models Distill / 深層模型精煉 436 Choosing Refactoring Targets / 選擇重構目標 437 Chapter 16: Large-Scale Structure / 大型結構 439 EVOLVING ORDER 444 SYSTEM METAPHOR 447 RESPONSIBILITY LAYERS 450 KNOWLEDGE LEVEL 465 PLUGGABLE COMPONENT FRAMEWORK 475 How Restrictive Should a Structure Be / 結構應該有一種什么樣的約束 480 Refactoring Toward a Fitting Structure / 通過重構得到更適當?shù)慕Y構 481 Minimalism / 最小化 481 Communication and Self-Discipline / 溝通和自律 482 Restructuring Yields Supple Design / 通過重構得到柔性設計 482 Distillation Lightens the Load / 通過精煉可以減輕負擔 483 Chapter 17: Bringing the Strategy Together / 領域驅動設計的綜合運用 485 Combining Large-Scale Structures and BOUNDED CONTEXTS / 把大型結構與BOUNDED CONTEXT結合起來使用 485 Combining Large-Scale Structures and Distillation / 將大型結構與精煉結合起來使用 488 Assessment First / 首先評估 490 Who Sets the Strategy / 由誰制定策略 490 Emergent Structure from Application Development / 從應用程序開發(fā)自動得出的結構 491 A Customer-Focused Architecture Team / 以客戶為中心的架構團隊 492 Six Essentials for Strategic Design Decision Making / 制定戰(zhàn)略設計決策的6個要點 492 The Same Goes for the Technical Frameworks / 技術框架同樣如此 495 Beware the Master Plan / 注意總體規(guī)劃 496 Conclusion / 結束語 499 Appendix: The Use of Patterns in This Book / 附錄:本書中模式的使用 507 Glossary / 術語表 511 References / 參考文獻 515 Photo Credits / 圖片說明 517