SlideShare a Scribd company logo
1 of 24
Introduction to Domain Driven
            Design
  How can an IT Dev Dept improve in
   achieving business driven goals
Successful enterprise must be able
adapt fast to new market conditions
IT department is a key element to
         support such change
• Business complexity grows and changes
  quickly!
• We must find the way how to achieve the
  goals set by a business!
Understand and follow DDD paradigms
We have been doing all these
 things, but our own way
Spaghetti code
Objects with too many responsibilities
Untested code is difficult to change
                later
• application bugs
• creating of Heroes
• barrier for new features
Fear Driven Development
We should utilize existing
knowledge and best practices
What is DDD?
• Domain Knowledge
• Ubiquitous Language
• Bounded Context
Layered Architecture
Building Blocks
•   Entity: Contractor, Contractor Rate
•   Value Object: CXC_Date
•   Aggregate: Invoice, Contractor, Wree
•   Service: Company Service
•   Factory: Company Contact Factory
•   Repository: Contractor Repository
Building Blocks
Started with Entities
Factories

Unit tested!
Services
Repositories
Repositories
Aggregates


        Aggregate Root




Aggregate Members
Value Objects
What is next?
Improve Domain Layer
• Ongoing process of refactoring driven by
  Business requirements
• No need for complete overhaul – iterative
  process is more aligned with Business needs.
Thank you!

More Related Content

What's hot

Agile Teams Deserve Agile Testing
Agile Teams Deserve Agile TestingAgile Teams Deserve Agile Testing
Agile Teams Deserve Agile TestingSmartBear
 
Behaviour Driven Development (BDD) With Apex on Force.com
Behaviour Driven Development (BDD) With Apex on Force.comBehaviour Driven Development (BDD) With Apex on Force.com
Behaviour Driven Development (BDD) With Apex on Force.comSalesforce Developers
 
Case Study: T-Mobile’s Agile Journey with CA Agile Central
Case Study: T-Mobile’s Agile Journey with CA Agile CentralCase Study: T-Mobile’s Agile Journey with CA Agile Central
Case Study: T-Mobile’s Agile Journey with CA Agile CentralCA Technologies
 
Etg coldfusion presentation
Etg coldfusion presentationEtg coldfusion presentation
Etg coldfusion presentationEtisbew-corp
 
Brook Software Slideshow
Brook Software SlideshowBrook Software Slideshow
Brook Software SlideshowBrookSoftware
 
Oracle P6 R8.1 EPS Issues
Oracle P6 R8.1 EPS IssuesOracle P6 R8.1 EPS Issues
Oracle P6 R8.1 EPS Issuesjshakeel
 
Atagg2015 Benefits of BDD in Digital Era
Atagg2015 Benefits of BDD in Digital EraAtagg2015 Benefits of BDD in Digital Era
Atagg2015 Benefits of BDD in Digital EraAgile Testing Alliance
 

What's hot (11)

Agile Teams Deserve Agile Testing
Agile Teams Deserve Agile TestingAgile Teams Deserve Agile Testing
Agile Teams Deserve Agile Testing
 
Gautam_CV
Gautam_CVGautam_CV
Gautam_CV
 
Behaviour Driven Development (BDD) With Apex on Force.com
Behaviour Driven Development (BDD) With Apex on Force.comBehaviour Driven Development (BDD) With Apex on Force.com
Behaviour Driven Development (BDD) With Apex on Force.com
 
Case Study: T-Mobile’s Agile Journey with CA Agile Central
Case Study: T-Mobile’s Agile Journey with CA Agile CentralCase Study: T-Mobile’s Agile Journey with CA Agile Central
Case Study: T-Mobile’s Agile Journey with CA Agile Central
 
Etg coldfusion presentation
Etg coldfusion presentationEtg coldfusion presentation
Etg coldfusion presentation
 
Mobiappstar brochure
Mobiappstar brochureMobiappstar brochure
Mobiappstar brochure
 
Brook Software Slideshow
Brook Software SlideshowBrook Software Slideshow
Brook Software Slideshow
 
Weblitesofttech ppt
Weblitesofttech pptWeblitesofttech ppt
Weblitesofttech ppt
 
Oracle P6 R8.1 EPS Issues
Oracle P6 R8.1 EPS IssuesOracle P6 R8.1 EPS Issues
Oracle P6 R8.1 EPS Issues
 
Atagg2015 Benefits of BDD in Digital Era
Atagg2015 Benefits of BDD in Digital EraAtagg2015 Benefits of BDD in Digital Era
Atagg2015 Benefits of BDD in Digital Era
 
Ecode intro v.2.03
Ecode intro v.2.03Ecode intro v.2.03
Ecode intro v.2.03
 

Similar to Domain Driven Design

Schibsted Spain - Day 1 - DDD Course
Schibsted Spain - Day 1 - DDD CourseSchibsted Spain - Day 1 - DDD Course
Schibsted Spain - Day 1 - DDD CourseKevin Mas Ruiz
 
DevOps Vancouver Meetup - WSBC Progress
DevOps Vancouver Meetup - WSBC ProgressDevOps Vancouver Meetup - WSBC Progress
DevOps Vancouver Meetup - WSBC ProgressAndre Kaminski
 
Prepare the sled in summer and project release at its beginning
Prepare the sled in summer and project release at its beginningPrepare the sled in summer and project release at its beginning
Prepare the sled in summer and project release at its beginningVadym Fedorov
 
Prashant technical practices-tdd for xebia event
Prashant   technical practices-tdd for xebia eventPrashant   technical practices-tdd for xebia event
Prashant technical practices-tdd for xebia eventXebia India
 
York edi, business objects and budget realities
York   edi, business objects and budget realitiesYork   edi, business objects and budget realities
York edi, business objects and budget realitiesDennis Bonagura
 
DOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps Story
DOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps StoryDOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps Story
DOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps StoryGene Kim
 
Sw Configuration Engineer
Sw Configuration EngineerSw Configuration Engineer
Sw Configuration EngineerJongens85
 
Critical Capabilities to Shifting Left the Right Way
Critical Capabilities to Shifting Left the Right WayCritical Capabilities to Shifting Left the Right Way
Critical Capabilities to Shifting Left the Right WaySmartBear
 
Biztech Consultancy Ppt
Biztech Consultancy PptBiztech Consultancy Ppt
Biztech Consultancy Pptkinjalmshah
 
GrayCell Corporate Presentation
GrayCell Corporate PresentationGrayCell Corporate Presentation
GrayCell Corporate PresentationAmit-GrayCell
 
MongoDB and Our Journey from Old, Slow and Monolithic to Fast and Agile Micro...
MongoDB and Our Journey from Old, Slow and Monolithic to Fast and Agile Micro...MongoDB and Our Journey from Old, Slow and Monolithic to Fast and Agile Micro...
MongoDB and Our Journey from Old, Slow and Monolithic to Fast and Agile Micro...MongoDB
 
Detail Guide - Hire Dedicated React Native Developers for your Project
Detail Guide - Hire Dedicated React Native Developers for your ProjectDetail Guide - Hire Dedicated React Native Developers for your Project
Detail Guide - Hire Dedicated React Native Developers for your ProjectSemaphoreSoftware1
 
Vishwanath_M_CV_NL
Vishwanath_M_CV_NLVishwanath_M_CV_NL
Vishwanath_M_CV_NLVishwanath M
 
Data integration case study: Oil & Gas industry
Data integration case study: Oil & Gas industryData integration case study: Oil & Gas industry
Data integration case study: Oil & Gas industryETLSolutions
 

Similar to Domain Driven Design (20)

Schibsted Spain - Day 1 - DDD Course
Schibsted Spain - Day 1 - DDD CourseSchibsted Spain - Day 1 - DDD Course
Schibsted Spain - Day 1 - DDD Course
 
DevOps Vancouver Meetup - WSBC Progress
DevOps Vancouver Meetup - WSBC ProgressDevOps Vancouver Meetup - WSBC Progress
DevOps Vancouver Meetup - WSBC Progress
 
Prepare the sled in summer and project release at its beginning
Prepare the sled in summer and project release at its beginningPrepare the sled in summer and project release at its beginning
Prepare the sled in summer and project release at its beginning
 
Prashant technical practices-tdd for xebia event
Prashant   technical practices-tdd for xebia eventPrashant   technical practices-tdd for xebia event
Prashant technical practices-tdd for xebia event
 
York edi, business objects and budget realities
York   edi, business objects and budget realitiesYork   edi, business objects and budget realities
York edi, business objects and budget realities
 
DOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps Story
DOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps StoryDOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps Story
DOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps Story
 
DevOps with Chef
DevOps with ChefDevOps with Chef
DevOps with Chef
 
Sw Configuration Engineer
Sw Configuration EngineerSw Configuration Engineer
Sw Configuration Engineer
 
Profile_Hadoop
Profile_HadoopProfile_Hadoop
Profile_Hadoop
 
Critical Capabilities to Shifting Left the Right Way
Critical Capabilities to Shifting Left the Right WayCritical Capabilities to Shifting Left the Right Way
Critical Capabilities to Shifting Left the Right Way
 
Biztech Consultancy Ppt
Biztech Consultancy PptBiztech Consultancy Ppt
Biztech Consultancy Ppt
 
GrayCell Corporate Presentation
GrayCell Corporate PresentationGrayCell Corporate Presentation
GrayCell Corporate Presentation
 
MongoDB and Our Journey from Old, Slow and Monolithic to Fast and Agile Micro...
MongoDB and Our Journey from Old, Slow and Monolithic to Fast and Agile Micro...MongoDB and Our Journey from Old, Slow and Monolithic to Fast and Agile Micro...
MongoDB and Our Journey from Old, Slow and Monolithic to Fast and Agile Micro...
 
Ravikumar_Resume
Ravikumar_ResumeRavikumar_Resume
Ravikumar_Resume
 
Detail Guide - Hire Dedicated React Native Developers for your Project
Detail Guide - Hire Dedicated React Native Developers for your ProjectDetail Guide - Hire Dedicated React Native Developers for your Project
Detail Guide - Hire Dedicated React Native Developers for your Project
 
Profile Meyyappan CV
Profile Meyyappan CVProfile Meyyappan CV
Profile Meyyappan CV
 
Technical Debt.pptx
Technical Debt.pptxTechnical Debt.pptx
Technical Debt.pptx
 
Vishwanath_M_CV_NL
Vishwanath_M_CV_NLVishwanath_M_CV_NL
Vishwanath_M_CV_NL
 
Abbas
AbbasAbbas
Abbas
 
Data integration case study: Oil & Gas industry
Data integration case study: Oil & Gas industryData integration case study: Oil & Gas industry
Data integration case study: Oil & Gas industry
 

Recently uploaded

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsAndrey Dotsenko
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 

Recently uploaded (20)

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 

Domain Driven Design

Editor's Notes

  1. When I was about to create a presentation about recent implementation of Repositories I realised that it would not be understood by our team without some proper introduction to Domain Driven Design. Therefore I decided to make a presentation about DDD instead and use Wiki to describe the processes around Repositories.
  2. Every enterprise must be able to adapt fast in order to survive in the market. Technology changes faster than ever before. Market demand and supply changes in volumes and in structure – constantly.
  3. And an IT department should be key a element to enable such change.But business complexity grows and changes quickly! Legislative changes ... Global Financial Crisis ... Competitors continually launching new products and so on.So we in IT must find a way how to achieve the goals set by the business!
  4. Domain Driven Design offers the solution.DDD is not about technology rather than about business modelling and its transformation into software. It describes the way how to do it and also how to solve common problems.
  5. But do we need another methodology, other processes to follow? Isn't it just some sort of abstract over complication? Let me explain!
  6. Spaghetti code is about processing data instead of building blocks. That means every where the data had been used, the code followed. It breaks the DRY principle and leads to spreading of Business Logic across the whole application.Later we started putting Business Logic into Objects, which was a great leap forward!
  7. Simply following OOP basics does not get the job done right. It can lead to creating of ‘Balls of Mud’ - classes with too many responsibilities which are breaking up the Single Responsibility Principle. Also subclassing/inheritance can be abused instead of using composition.Mixed responsibilities lead to unpredictable behaviour.Such class takes too long to read and understand and even longer to change.
  8. Changing untested code has unpredictable consequences. Untested code is often the cause of: *) application bugs*) creation of Heroes – only the developer who developed the code can maintain it*) barrier for implementation of any new features – nobody wants to change such a part of the system – which leads to FDD
  9. People are afraid of making changes to a code and would rather maintain it in its current state or demand complete overhaul before executing any - even small changes.
  10. There are many ways how to provide business what it requires: Agile, RUP, Lean etcToday I would like to focus on DDD.Domain-driven design (DDD) is an approach to developing software for complex needs by deeply connecting the implementation to an evolving model of the core business concepts. The premise of domain-driven design is the following:*) Placing the project's primary focus on the core domain and domain logic*) Basing complex designs on a model*) Initiating a creative collaboration between technical and domain experts to iteratively cut ever closer to the conceptual heart of the problem.Domain-driven design is not a technology or a methodology. DDD provides a structure of practices and terminology for making design decisions that focus and accelerate software projects dealing with complicated domains.The term was coined by Eric Evans in his book of the same title:Domain-Driven Design - Tackling Complexity in the Heart of Software
  11. So what is the DDD?Domain: A sphere of knowledge or activity. The subject area to which the user applies a program – that is the domain of the software.Ubiquitous Language: A language structured around the domain model and used by all team members to connect all the activities of the team with the software. E.g. ‘Invoice Balance’ or ‘Released Pay’Context: The setting in which a word or statement appears that determines its meaning.
  12. User Interface / Presentation Layer: Responsible for presenting information to the user and interpreting user commands.Application Layer: This layer coordinates the application activity. It doesn't contain any business logic. It can hold the state of an application task's progress.Domain Layer: This layer contains information about the business domain - the heart of software. The state of business objects is held here. Persistence of the business objects is delegated to the infrastructure layer.Infrastructure Layer: This layer acts as a supporting library for all the other layers. It provides communication between layers, implements persistence for business objects, contains supporting libraries for the user interface layer, etc.
  13. Entity: An object that is not defined by its attributes, but rather by a thread of continuity and its identity.Example: Invoice, Payroll, Contractor. Identity can be provided Invoice ID or for Contractor by some Customer reference number (not necessarily by database id)Value Object: An object that contains attributes but has no conceptual identity. They should be treated as immutable.Example: CXC_Date - date does not have any identity, but it is distinguished by its value. Another example can be Price consisting of amount and currency.  Aggregate: A collection of objects that are bound together by a root entity, otherwise known as an aggregate root. The aggregate root guarantees the consistency of changes being made within the aggregate by forbidding external objects from holding references to its members.Example: Invoice and its Invoice Items or Contract and its Contract Rates. Service: When an operation does not conceptually belong to any concrete object, one can implement these operations in services. Service operation is stateless. Example: 'Assign contracts to manager' or 'Calculate Payroll'. Factory: methods for creating domain objects should be delegated to a specialized Factory object so alternative implementations may be easily interchanged.Example: Payroll Builder - to build a payroll requires too many tasks to just make it part of Payroll object itself, therefore dedicated object is required which sole purpose is to Build the Payroll object.Repositories: methods for retrieving domain objects should be delegated to a specialized Repository object so that alternative storage implementations may be easily interchanged. Repositories should provide abstraction of persistence storage to Domain layer. They are not the same as Factories, because process of building and retrieving from repository is completely different. Example: Newly created repositories in PAYX.
  14. It all began when the PAYX/lib folder was introduced. It was a good start to achieving the multilayered architecture – to separate the Model from Views and Controllers. But what went wrong was all the classes suddenly became Entities – they became overcomplicated and unmaintainable, untested and actually untestable.
  15. One day time we started using Unit Testing. Then we realised our current approach is making Unit Testing hard. We replaced static methods or functions with Factories
  16. Later we replaced other static methods with Domain Services. It improved testability and clarity of the Domain, but unfortunatelyServices had too many responsibilities. It led to mocking of methods of the same class during unit testing. This was the reason we implemented ...
  17. Now this is the last part we finally introduced to PAYX. Repositories provide methods for retrieving domain objects from persistence storage and are creating an illusion of in-memory object graph for the Domain Layer. By injecting Repositories we can easy make the unit tests DB independent.
  18. But also we can easily swap persistence storage without affecting Domain!
  19. Good examples for Aggregates in PAYX are Invoice with its Invoice Items or Wree with Wree Items.
  20. As I already mentioned an example is CXC_Date or Contract_Number class.
  21. Are we done here? Shall we have a beer?! Not yet!