SlideShare une entreprise Scribd logo
1  sur  33
Brief Introduction to
   Domain Driven
    Design(DDD)
              Yongqiang
Outline

 What’s Domain?
 What’s the heart of a software?

 What’s DDD?

 Crunching Knowledge

 Ubiquitous Language

 Basic Elements in DDD

 Summary

 References
What’s Domain?

    在 DDD 中所指就是企业软件所涉及
 Domain
 的业务领域,其中包含大量业务知识。
What’s the heart of a software?

 导演-> 软件用户
 剪辑师 -> 软件工程师




 剪辑师为什么没有解决导演的
 问题?
 Theheart of software is its ability to solve
  domain-related problems for its users! ( 软
  件的核心价值是为客户解决业务问题)。
 如果想做出色的业务软件,前提就是对用
  户所处的领域有充分的,全面的,深刻的
  理解!
What’s DDD?

 领域驱动开发

    Evans 创始人
 Eric

 目标:让软件成为领域的映射。
     软件需要具现领域里重要的核心概念和元素,并精
      确实现它们之间的关系。
     软件需要对领域进行建模,得到一个关于领域的
      模型。
 中心内容:如何将业务领域概念映射到软件工
  件中
Crunching Knowledge( 知识汲
取)
 Talk with domain expert
 Lead by developers

 Domain model is focused on the most
  valuable part
 Developer needs feedback

 We never know enough

 We need knowledge-rich design

 Binding model and implementation
Ubiquitous Language( 通用语
言)
   For each term, we need
    a very precisely and
    unambiguously defined
    meaning
   spanning from
    discussions with the
    domain expert to the
    code level
   assures that everybody in
    the team shares the
    same vision about the
    domain and the software.
So...

 Modelingout loud!
 One Team, One Language!
Basic Elements in DDD
Layered Architecture
Entity
 An  object define primarily by its identity is
  called an Entity.
 Most basic responsibility of Entities is to
  establish continuity so that behavior can be
  clear and predictable.     class Person CD


                                       BankAccount

                                 -   AccountId
                                 -   Deposit
                                 -   UserName
 Attributes   VS. Identity

                class Person CD


                             Person

                    -   BirthDate
                    -   BirthPlace
                    -   Id
                    -   Name
                    -   Parents
Value Object( 值对象 )

 An  object that represents a descriptive aspect
  of the domain with no conceptual identity is
  called a VALUE OBJECT.
 VALUE OBJECTS are often passed as
  parameters in messages between objects.
         class Person CD   class Person CD


                   Point           Address

             -   X: int        -   City
             -   Y: int        -   Street
 帮助简化设计

 没有标识符,值
  对象可以被轻易
  地创建或者丢弃
  。
 极力推荐值对象
  是不变的。
Service( 服务 )

 Some   of these are intrinsically activities or
  actions, not things.
 A service tends to be named for an activity,
  rather that an entity-a verb rather that a
  noun.
 A service does not do much on its own; it
  would ask other objects to do most of
  work.
 Partition   Services into Layers
     Application
     Domain
     Infrastructure
Life Cycle of Domain Object

 Aggregates     聚合
    用于打破对象的网状关系 , 定义所有权和边界
 Factories   工厂
    用于领域对象生命周期的开始部分 , 创建或者重组
     复杂的对象或 Aggregates.
 Repositories   资源库
    用于领域对象生命周期的中后部 , 对存储 , 检索查
     询等功能进行了封装 .
Aggregate( 聚合 )

 An  aggregate is a cluster of associated
  objects that we treat as a unit for the purpose
  of data changes. Each aggregate has a root
  of a boundary.
 The root is the only member of the Aggregate
  that outside objects are allowed to hold
  references.
 Invariants,
           which are consistency rules that
  must be maintained whenever data changes.
Factory( 工厂 )

 Creation  of an object can be a major
  operation in itself, but complex assembly
  operations do not fit the responsibility of
  the created objects. Combining such
  responsibilities can produce ungainly designs
  that are hard to understand.
 A program element whose responsibility is
  the creation of other objects is called a
  FACTORY.
 Two   basic requirements for any good Factory
 are
    Each creation method is atomic and enforces all
     invariants of the created object or AGGREGATE.
    The FACTORY should be abstracted to the type
     desired, rather than the concrete class(es)
     created.
Repositories( 资源库 )

 Global   Access
    Aggregate roots which are not convenient to
     reach by traversal.
    Value Objects with complex internal structure.
    enumerated values.
 Two   ways to query a repository
    Hard-coded query with specific parameter.
    Specification-based query.
By specific parameter




By criteria
Summary

 DDD 目标是建立最适合的模型映射领域知识
  ,以模型做为团队交流和软件开发的基础。
 DDD 对企业应用软件中的基础元素做了合理
  的抽象。
 DDD 可以和 TDD, 敏捷开发方法联合使用。
References

 EricEvans 《领域驱动设计—软件核心复杂
  性应对之道》
 InfoQ 《领域驱动设计精简版》

Contenu connexe

Similaire à Brief introduction to domain-driven design

BDD communication bridges - Expedia TED talk
BDD communication bridges - Expedia TED talkBDD communication bridges - Expedia TED talk
BDD communication bridges - Expedia TED talkAliaksandr Ikhelis
 
InfoFusion Overview And Roadmap
InfoFusion Overview And RoadmapInfoFusion Overview And Roadmap
InfoFusion Overview And RoadmapMarten den Haring
 
Ai Brain Docs Solution Oct 2012
Ai Brain Docs Solution Oct 2012Ai Brain Docs Solution Oct 2012
Ai Brain Docs Solution Oct 2012tom_marsh
 
Domain Driven Design(DDD) Presentation
Domain Driven Design(DDD) PresentationDomain Driven Design(DDD) Presentation
Domain Driven Design(DDD) PresentationOğuzhan Soykan
 
Framework Engineering_Final
Framework Engineering_FinalFramework Engineering_Final
Framework Engineering_FinalYoungSu Son
 
Authorization Services
Authorization ServicesAuthorization Services
Authorization ServicesEmpowerID
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven DesignLalit Kale
 
Introduction to Domain-Driven Design
Introduction to Domain-Driven DesignIntroduction to Domain-Driven Design
Introduction to Domain-Driven DesignR-P-Azevedo
 
“A Practitioner’s View” on the latest trends and information on BI/ DW techno...
“A Practitioner’s View” on the latest trends and information on BI/ DW techno...“A Practitioner’s View” on the latest trends and information on BI/ DW techno...
“A Practitioner’s View” on the latest trends and information on BI/ DW techno...Hazelknight Media & Entertainment Pvt Ltd
 
Hibernate training at HarshithaTechnologySolutions @ Nizampet
Hibernate training at HarshithaTechnologySolutions @ NizampetHibernate training at HarshithaTechnologySolutions @ Nizampet
Hibernate training at HarshithaTechnologySolutions @ NizampetJayarajus
 
Elements of DDD with ASP.NET MVC & Entity Framework Code First
Elements of DDD with ASP.NET MVC & Entity Framework Code FirstElements of DDD with ASP.NET MVC & Entity Framework Code First
Elements of DDD with ASP.NET MVC & Entity Framework Code FirstEnea Gabriel
 
Computer Science Related Questions
Computer Science Related QuestionsComputer Science Related Questions
Computer Science Related QuestionsBravoLulu1
 
Dojo CRUD Components
Dojo CRUD ComponentsDojo CRUD Components
Dojo CRUD ComponentsTom Mahieu
 
iPhone Workshop Mobile Monday Ahmedabad
iPhone Workshop Mobile Monday AhmedabadiPhone Workshop Mobile Monday Ahmedabad
iPhone Workshop Mobile Monday Ahmedabadmomoahmedabad
 
Understanding Interaction Design
Understanding Interaction DesignUnderstanding Interaction Design
Understanding Interaction DesignDavid Rondeau
 
Domain-Driven Design
Domain-Driven DesignDomain-Driven Design
Domain-Driven DesignAndriy Buday
 
BDD presentation
BDD presentationBDD presentation
BDD presentationtemebele
 
ISWC 2012 - Industry Track - Linked Enterprise Data: leveraging the Semantic ...
ISWC 2012 - Industry Track - Linked Enterprise Data: leveraging the Semantic ...ISWC 2012 - Industry Track - Linked Enterprise Data: leveraging the Semantic ...
ISWC 2012 - Industry Track - Linked Enterprise Data: leveraging the Semantic ...Antidot
 

Similaire à Brief introduction to domain-driven design (20)

BDD communication bridges - Expedia TED talk
BDD communication bridges - Expedia TED talkBDD communication bridges - Expedia TED talk
BDD communication bridges - Expedia TED talk
 
InfoFusion Overview And Roadmap
InfoFusion Overview And RoadmapInfoFusion Overview And Roadmap
InfoFusion Overview And Roadmap
 
Ai Brain Docs Solution Oct 2012
Ai Brain Docs Solution Oct 2012Ai Brain Docs Solution Oct 2012
Ai Brain Docs Solution Oct 2012
 
Domain Driven Design(DDD) Presentation
Domain Driven Design(DDD) PresentationDomain Driven Design(DDD) Presentation
Domain Driven Design(DDD) Presentation
 
Framework Engineering_Final
Framework Engineering_FinalFramework Engineering_Final
Framework Engineering_Final
 
Authorization Services
Authorization ServicesAuthorization Services
Authorization Services
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Introduction to Domain-Driven Design
Introduction to Domain-Driven DesignIntroduction to Domain-Driven Design
Introduction to Domain-Driven Design
 
“A Practitioner’s View” on the latest trends and information on BI/ DW techno...
“A Practitioner’s View” on the latest trends and information on BI/ DW techno...“A Practitioner’s View” on the latest trends and information on BI/ DW techno...
“A Practitioner’s View” on the latest trends and information on BI/ DW techno...
 
Hibernate training at HarshithaTechnologySolutions @ Nizampet
Hibernate training at HarshithaTechnologySolutions @ NizampetHibernate training at HarshithaTechnologySolutions @ Nizampet
Hibernate training at HarshithaTechnologySolutions @ Nizampet
 
Elements of DDD with ASP.NET MVC & Entity Framework Code First
Elements of DDD with ASP.NET MVC & Entity Framework Code FirstElements of DDD with ASP.NET MVC & Entity Framework Code First
Elements of DDD with ASP.NET MVC & Entity Framework Code First
 
Computer Science Related Questions
Computer Science Related QuestionsComputer Science Related Questions
Computer Science Related Questions
 
Dojo CRUD Components
Dojo CRUD ComponentsDojo CRUD Components
Dojo CRUD Components
 
iPhone Workshop Mobile Monday Ahmedabad
iPhone Workshop Mobile Monday AhmedabadiPhone Workshop Mobile Monday Ahmedabad
iPhone Workshop Mobile Monday Ahmedabad
 
Understanding Interaction Design
Understanding Interaction DesignUnderstanding Interaction Design
Understanding Interaction Design
 
Domain-Driven Design
Domain-Driven DesignDomain-Driven Design
Domain-Driven Design
 
BDD presentation
BDD presentationBDD presentation
BDD presentation
 
RavenDB overview
RavenDB overviewRavenDB overview
RavenDB overview
 
Object oriented concepts
Object oriented conceptsObject oriented concepts
Object oriented concepts
 
ISWC 2012 - Industry Track - Linked Enterprise Data: leveraging the Semantic ...
ISWC 2012 - Industry Track - Linked Enterprise Data: leveraging the Semantic ...ISWC 2012 - Industry Track - Linked Enterprise Data: leveraging the Semantic ...
ISWC 2012 - Industry Track - Linked Enterprise Data: leveraging the Semantic ...
 

Plus de Yongqiang Li

How to Recognize Henry's Face
How to Recognize Henry's FaceHow to Recognize Henry's Face
How to Recognize Henry's FaceYongqiang Li
 
Introduction to Boost regex
Introduction to Boost regexIntroduction to Boost regex
Introduction to Boost regexYongqiang Li
 
Let's talk about java class loader
Let's talk about java class loaderLet's talk about java class loader
Let's talk about java class loaderYongqiang Li
 
Let's talk about java class file
Let's talk about java class fileLet's talk about java class file
Let's talk about java class fileYongqiang Li
 
Eclipse GEF (Part I)
Eclipse GEF (Part I)Eclipse GEF (Part I)
Eclipse GEF (Part I)Yongqiang Li
 
Garbage Collection of Java VM
Garbage Collection of Java VMGarbage Collection of Java VM
Garbage Collection of Java VMYongqiang Li
 
Let's talk about jni
Let's talk about jniLet's talk about jni
Let's talk about jniYongqiang Li
 

Plus de Yongqiang Li (8)

Why Kotlin?
Why Kotlin?Why Kotlin?
Why Kotlin?
 
How to Recognize Henry's Face
How to Recognize Henry's FaceHow to Recognize Henry's Face
How to Recognize Henry's Face
 
Introduction to Boost regex
Introduction to Boost regexIntroduction to Boost regex
Introduction to Boost regex
 
Let's talk about java class loader
Let's talk about java class loaderLet's talk about java class loader
Let's talk about java class loader
 
Let's talk about java class file
Let's talk about java class fileLet's talk about java class file
Let's talk about java class file
 
Eclipse GEF (Part I)
Eclipse GEF (Part I)Eclipse GEF (Part I)
Eclipse GEF (Part I)
 
Garbage Collection of Java VM
Garbage Collection of Java VMGarbage Collection of Java VM
Garbage Collection of Java VM
 
Let's talk about jni
Let's talk about jniLet's talk about jni
Let's talk about jni
 

Dernier

Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 

Dernier (20)

Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

Brief introduction to domain-driven design

  • 1. Brief Introduction to Domain Driven Design(DDD) Yongqiang
  • 2. Outline  What’s Domain?  What’s the heart of a software?  What’s DDD?  Crunching Knowledge  Ubiquitous Language  Basic Elements in DDD  Summary  References
  • 3. What’s Domain? 在 DDD 中所指就是企业软件所涉及  Domain 的业务领域,其中包含大量业务知识。
  • 4. What’s the heart of a software?  导演-> 软件用户  剪辑师 -> 软件工程师 剪辑师为什么没有解决导演的 问题?
  • 5.  Theheart of software is its ability to solve domain-related problems for its users! ( 软 件的核心价值是为客户解决业务问题)。  如果想做出色的业务软件,前提就是对用 户所处的领域有充分的,全面的,深刻的 理解!
  • 6. What’s DDD?  领域驱动开发 Evans 创始人  Eric  目标:让软件成为领域的映射。  软件需要具现领域里重要的核心概念和元素,并精 确实现它们之间的关系。  软件需要对领域进行建模,得到一个关于领域的 模型。  中心内容:如何将业务领域概念映射到软件工 件中
  • 7. Crunching Knowledge( 知识汲 取)  Talk with domain expert  Lead by developers  Domain model is focused on the most valuable part  Developer needs feedback  We never know enough  We need knowledge-rich design  Binding model and implementation
  • 8. Ubiquitous Language( 通用语 言)  For each term, we need a very precisely and unambiguously defined meaning  spanning from discussions with the domain expert to the code level  assures that everybody in the team shares the same vision about the domain and the software.
  • 9. So...  Modelingout loud!  One Team, One Language!
  • 11.
  • 12.
  • 14.
  • 15. Entity  An object define primarily by its identity is called an Entity.  Most basic responsibility of Entities is to establish continuity so that behavior can be clear and predictable. class Person CD BankAccount - AccountId - Deposit - UserName
  • 16.  Attributes VS. Identity class Person CD Person - BirthDate - BirthPlace - Id - Name - Parents
  • 17. Value Object( 值对象 )  An object that represents a descriptive aspect of the domain with no conceptual identity is called a VALUE OBJECT.  VALUE OBJECTS are often passed as parameters in messages between objects. class Person CD class Person CD Point Address - X: int - City - Y: int - Street
  • 18.  帮助简化设计  没有标识符,值 对象可以被轻易 地创建或者丢弃 。  极力推荐值对象 是不变的。
  • 19. Service( 服务 )  Some of these are intrinsically activities or actions, not things.  A service tends to be named for an activity, rather that an entity-a verb rather that a noun.  A service does not do much on its own; it would ask other objects to do most of work.
  • 20.  Partition Services into Layers  Application  Domain  Infrastructure
  • 21.
  • 22.
  • 23. Life Cycle of Domain Object  Aggregates 聚合  用于打破对象的网状关系 , 定义所有权和边界  Factories 工厂  用于领域对象生命周期的开始部分 , 创建或者重组 复杂的对象或 Aggregates.  Repositories 资源库  用于领域对象生命周期的中后部 , 对存储 , 检索查 询等功能进行了封装 .
  • 24. Aggregate( 聚合 )  An aggregate is a cluster of associated objects that we treat as a unit for the purpose of data changes. Each aggregate has a root of a boundary.  The root is the only member of the Aggregate that outside objects are allowed to hold references.
  • 25.
  • 26.  Invariants, which are consistency rules that must be maintained whenever data changes.
  • 27. Factory( 工厂 )  Creation of an object can be a major operation in itself, but complex assembly operations do not fit the responsibility of the created objects. Combining such responsibilities can produce ungainly designs that are hard to understand.  A program element whose responsibility is the creation of other objects is called a FACTORY.
  • 28.  Two basic requirements for any good Factory are  Each creation method is atomic and enforces all invariants of the created object or AGGREGATE.  The FACTORY should be abstracted to the type desired, rather than the concrete class(es) created.
  • 29.
  • 30. Repositories( 资源库 )  Global Access  Aggregate roots which are not convenient to reach by traversal.  Value Objects with complex internal structure.  enumerated values.  Two ways to query a repository  Hard-coded query with specific parameter.  Specification-based query.
  • 32. Summary  DDD 目标是建立最适合的模型映射领域知识 ,以模型做为团队交流和软件开发的基础。  DDD 对企业应用软件中的基础元素做了合理 的抽象。  DDD 可以和 TDD, 敏捷开发方法联合使用。
  • 33. References  EricEvans 《领域驱动设计—软件核心复杂 性应对之道》  InfoQ 《领域驱动设计精简版》

Notes de l'éditeur

  1. 软件截图来自网络
  2. 电影截图来自网络