SlideShare a Scribd company logo
1 of 38
Copyright © 2015 SolutionsIQ Inc. All rights reserved.
6801 185th Ave NE, Suite 200
Redmond, WA 98052
solutionsiq.com
1.800.235.4091
The craft of business driven design
Agenda
• We will learn one strategic design pattern in Domain driven design
• This is the most important and fundamental pattern in Domain driven design
XPIndia2016 3
All problems , functions and objects depicted in this workshop are
entirely fictitious. Any similarity to actual problems , classes or
functions living or dead, is purely coincidental.
XPIndia2016 4
XPIndia2016 5
e Slide
XPIndia2016 6
Operator
Name
Id
Login()
Customer
Name
Phone
ID
Booking system
book(Customer)
List <Trip>
Cab Tracker
getCabs(Count , SrcID )
Route getRoute(SrcID , DesID )
Cab
Driver Name
Phone No
ID
Trip
LocID SrcID
LocID DesID
Cab
Customer
route
administration
AddCab( cab)
Add Customer ()
ActivateCab()
DeActivateCab()
Reports
sendSMS()
Route
List <LocID>
ID Customer name p
h
ID Driver name p
h
» Legacy system design XPIndia2016 7
*
 As a customer of SheTaxi , I want to book the nearest SheTaxi
based on my GPS location so that I reach my destination ASAP.
 As a car owner, I want to attach myself to SheTaxi so that I get
more customers
 As a customer of SheTaxi , I want to view the rate card so that I
can estimate the fare .
XPIndia2016 8
» A
 As a customer of SheTaxi , I want to view available cabs based on
a given gps location so that I get approximate time I need to wait
after booking .
 As a customer of SheTaxi , I want to view the approximate fare of
my journey so that I can estimate the fare .
 As the management of SheTaxi , I want customers to rate the
driver in a scale of 1 to 5 , 1 being worst and 5 being best , so we
can get feedback and improve our services .
» B
XPIndia2016 9
As the management of SheTaxi, we want to track the exact route
using GPS coordinates , time taken and distance travelled so that
SheTaxi can generate invoices to customers .
As a SheTaxi cabdriver , I want to get a route map (GPS coordinates )
based on my customers destination and pickup point so that I can
complete my trip ASAP.
As the management of SheTaxi , we want an exclusive feature for
our VIP customers, an option to book cab drivers with rating 4+ so
that we can retain our VIP customers.
» C
XPIndia2016 10
As a customer of SheTaxi , I want my invoice be emailed so that I
need not ask for a written invoice.
As the management of SheTaxi , I want to access previous trip data
for each drivers so that we can make weekly payments to them
As the management of SheTaxi , we want an exclusive feature for
our VIP customers, an option to integrate their invoices to ”
www.expensify.com”
» D
XPIndia2016 11
Example : Super Market
I 'am using a simple example to explain the problem , same is applicable for bigger complex systems
The super market has many products to sell
Each product has a
 quality
 cost
The rules for computation of Quality and Cost are different for
each product
Abstract Product
computeQuality()
computeCost ()
Concreate product 1
Concreate product 2
Concreate product n-1
Concreate product N
Example of a
concreate product
XPIndia2016 12
Is this the best design ?
Onion
computeQuality()
computeCost ()
»Is this following SRP ? Single responsibility principle
»SRP : A class should have only one reason to change
»What if the pricing strategy of a product varies
from time to time ?
XPIndia2016 13
How about a different design
Abstract Product
Pricing strategy
computeQuality()
Concreate product 1
Concreate product 2
Concreate product n-1
Concreate product N
PricingStrategy
CompteCost()
Strategy 1
Strategy 2
Strategy 3
XPIndia2016 14
Another design
Product
PricingStrategy
QualityRule
PricingStrategy
CompteCost()
Strategy 1
Strategy 2
Strategy 3
QualityRule
Quality()
Rule 1
Rule 2
XPIndia2016 15
Which design is better ?
XPIndia2016 16
Which design is better ?
Answer is : it depends
Dependents on what ?
Lest try to define this context
Context
XPIndia2016 17
Which design is better ?
If mostly we will be only adding / removing products
XPIndia2016 18
Which design is better ?
• We will be constantly adding new products , also
• We need to modify pricing strategy every now and then
for existing products
XPIndia2016 19
Which design is better ?
• We need to often modify both pricing strategy & quality
rule for existing products
XPIndia2016 20
There is nothing like a good or bad design
we can only evaluate a design once we associate it with
a context
The context is the actual business problem we need to
solve
XPIndia2016 21
Coordinate geometry package Graphics rendering package
Core library
Team BTeam A
XPIndia2016 22
Coordinate geometry package Graphics rendering package
Team A Team B
float x , float y , float length, float
breath
Line getDiagonal()
Float getDistanceFromPoint(Point)
Void transform(Matrix)
Float getSurfaceArea…………
float x , float y , float length, float
breath
Image Texture;
Line get Diagonal ()
Matrix Convert (matrix)
Float getDistanceFromPoint(Point)
Void transform(Matrix)
Float getSurfaceArea
Void Scale (int x)
Void deform (matrix)
float x , float y , float length, float
breath , int height , int width
Image Texture;
Line get Diagonal()
Matrix Convert (matrix)
Float getDistanceFromPoint(Point)
Void transform(Matrix)
Float getSurfaceArea
Void Scale (int x)
Void deform (matrix)
»The dirty evolution of rectangle class
XPIndia2016 23
Coordinate geometry package Graphics rendering package
Core library
Team BTeam A
XPIndia2016 24
If design reuse is done incorrectly it could slowly ,
unknowingly contaminate the entire system
XPIndia2016 25
XPIndia2016 26
Which design decision is better to store cab locations in real time ?
XPIndia2016 27
» Accuracy ++
» Complexity++
» Retrieval performance –-
» Shortest route++
» Accuracy --
» Simplicity ++
» Retrieval performance++
» Shortest route --
• Design reuse is always good
• Software design should always strive towards perfection
XPIndia2016 28
Myths
Domain , sub domain and Bounded Context
XPIndia2016 29
Context Map
XPIndia2016 30
Bounded Context is an explicit boundary within which a
domain model exists
XPIndia2016 31
• Design reuse is always good within its bounded context
• Software design should always strive towards perfection with
in its bounded context
XPIndia2016 32
Let apply what we learned and redesign
XPIndia2016 33
XPIndia2016 34
Present your design
Domain Driven Design what we didn’t cover
XPIndia2016 35
• Entity
• Value Object
• Aggregate
• Domain Event
• Service
• Repository
• Factory
» Ubiquitous language
If your bitten by the DDD bug you have two choices ,the blue pill or the red pill
XPIndia2016 36
Questions
XPIndia2016 37
Domain Driven Design what we didn’t cover
XPIndia2016 38

More Related Content

Similar to DDD_upload

Questions On The Equation For Regression
Questions On The Equation For RegressionQuestions On The Equation For Regression
Questions On The Equation For Regression
Tiffany Sandoval
 
Transportation managemenyt 6.0
Transportation managemenyt 6.0Transportation managemenyt 6.0
Transportation managemenyt 6.0
Vijay Pandiarajan
 
Acs Leave Behind.8x4
Acs Leave Behind.8x4Acs Leave Behind.8x4
Acs Leave Behind.8x4
ErinYoung
 

Similar to DDD_upload (20)

The Sizmek_Tech solutions
The Sizmek_Tech solutionsThe Sizmek_Tech solutions
The Sizmek_Tech solutions
 
Patterns and practices for real-world event-driven microservices by Rachel Re...
Patterns and practices for real-world event-driven microservices by Rachel Re...Patterns and practices for real-world event-driven microservices by Rachel Re...
Patterns and practices for real-world event-driven microservices by Rachel Re...
 
Patterns and practices for real-world event-driven microservices
Patterns and practices for real-world event-driven microservicesPatterns and practices for real-world event-driven microservices
Patterns and practices for real-world event-driven microservices
 
The process of version migration from older versions of Navision to NAV 2013 R2 
The process of version migration from older versions of Navision to NAV 2013 R2 The process of version migration from older versions of Navision to NAV 2013 R2 
The process of version migration from older versions of Navision to NAV 2013 R2 
 
cbse 12 computer science IP
cbse 12 computer science IPcbse 12 computer science IP
cbse 12 computer science IP
 
Big Data, Bigger Analytics
Big Data, Bigger AnalyticsBig Data, Bigger Analytics
Big Data, Bigger Analytics
 
How to upgrade / migrate Microsoft Dynamics NAV older versions
How to upgrade / migrate Microsoft Dynamics NAV older versionsHow to upgrade / migrate Microsoft Dynamics NAV older versions
How to upgrade / migrate Microsoft Dynamics NAV older versions
 
Re-engineering Technology to break barriers with Business
Re-engineering Technology to break barriers with BusinessRe-engineering Technology to break barriers with Business
Re-engineering Technology to break barriers with Business
 
Questions On The Equation For Regression
Questions On The Equation For RegressionQuestions On The Equation For Regression
Questions On The Equation For Regression
 
Online advertising and large scale model fitting
Online advertising and large scale model fittingOnline advertising and large scale model fitting
Online advertising and large scale model fitting
 
Value of Data Science
Value of Data ScienceValue of Data Science
Value of Data Science
 
Transportation managemenyt 6.0
Transportation managemenyt 6.0Transportation managemenyt 6.0
Transportation managemenyt 6.0
 
Lane Matching Solution to Fill Capacity with Backhauls
Lane Matching Solution to Fill Capacity with BackhaulsLane Matching Solution to Fill Capacity with Backhauls
Lane Matching Solution to Fill Capacity with Backhauls
 
cbse 12 computer science investigatory project
cbse 12 computer science investigatory project  cbse 12 computer science investigatory project
cbse 12 computer science investigatory project
 
cbse 12 computer science investigatory project
cbse 12 computer science investigatory project  cbse 12 computer science investigatory project
cbse 12 computer science investigatory project
 
ACS Expedited Solutions
ACS Expedited SolutionsACS Expedited Solutions
ACS Expedited Solutions
 
Acs Leave Behind.8x4
Acs Leave Behind.8x4Acs Leave Behind.8x4
Acs Leave Behind.8x4
 
Netflix Machine Learning Infra for Recommendations - 2018
Netflix Machine Learning Infra for Recommendations - 2018Netflix Machine Learning Infra for Recommendations - 2018
Netflix Machine Learning Infra for Recommendations - 2018
 
ML Infra for Netflix Recommendations - AI NEXTCon talk
ML Infra for Netflix Recommendations - AI NEXTCon talkML Infra for Netflix Recommendations - AI NEXTCon talk
ML Infra for Netflix Recommendations - AI NEXTCon talk
 
From a hack to Data Mesh (Devoxx 2022)
From a hack to Data Mesh (Devoxx 2022)From a hack to Data Mesh (Devoxx 2022)
From a hack to Data Mesh (Devoxx 2022)
 

More from Ranjith Tharayil

More from Ranjith Tharayil (8)

SHE QC ideation, a story grooming technique
SHE QC ideation, a story grooming techniqueSHE QC ideation, a story grooming technique
SHE QC ideation, a story grooming technique
 
Dojo delivery agility ranjith tharayil
Dojo delivery agility  ranjith tharayilDojo delivery agility  ranjith tharayil
Dojo delivery agility ranjith tharayil
 
Change Vector Tracking in emergent design
Change Vector Tracking in emergent designChange Vector Tracking in emergent design
Change Vector Tracking in emergent design
 
Case study of Knights capital and Toyota , a retrospect
Case study of Knights capital and Toyota , a retrospect  Case study of Knights capital and Toyota , a retrospect
Case study of Knights capital and Toyota , a retrospect
 
Change vector tracking in emergent design
Change vector tracking in emergent designChange vector tracking in emergent design
Change vector tracking in emergent design
 
When to embrace Behavior Driven Development?
When to embrace Behavior Driven Development?When to embrace Behavior Driven Development?
When to embrace Behavior Driven Development?
 
When to embrace behavior driven development
When to embrace behavior driven developmentWhen to embrace behavior driven development
When to embrace behavior driven development
 
Introduction to BDD
Introduction to BDD Introduction to BDD
Introduction to BDD
 

DDD_upload

  • 1.
  • 2. Copyright © 2015 SolutionsIQ Inc. All rights reserved. 6801 185th Ave NE, Suite 200 Redmond, WA 98052 solutionsiq.com 1.800.235.4091 The craft of business driven design
  • 3. Agenda • We will learn one strategic design pattern in Domain driven design • This is the most important and fundamental pattern in Domain driven design XPIndia2016 3
  • 4. All problems , functions and objects depicted in this workshop are entirely fictitious. Any similarity to actual problems , classes or functions living or dead, is purely coincidental. XPIndia2016 4
  • 7. Operator Name Id Login() Customer Name Phone ID Booking system book(Customer) List <Trip> Cab Tracker getCabs(Count , SrcID ) Route getRoute(SrcID , DesID ) Cab Driver Name Phone No ID Trip LocID SrcID LocID DesID Cab Customer route administration AddCab( cab) Add Customer () ActivateCab() DeActivateCab() Reports sendSMS() Route List <LocID> ID Customer name p h ID Driver name p h » Legacy system design XPIndia2016 7 *
  • 8.  As a customer of SheTaxi , I want to book the nearest SheTaxi based on my GPS location so that I reach my destination ASAP.  As a car owner, I want to attach myself to SheTaxi so that I get more customers  As a customer of SheTaxi , I want to view the rate card so that I can estimate the fare . XPIndia2016 8 » A
  • 9.  As a customer of SheTaxi , I want to view available cabs based on a given gps location so that I get approximate time I need to wait after booking .  As a customer of SheTaxi , I want to view the approximate fare of my journey so that I can estimate the fare .  As the management of SheTaxi , I want customers to rate the driver in a scale of 1 to 5 , 1 being worst and 5 being best , so we can get feedback and improve our services . » B XPIndia2016 9
  • 10. As the management of SheTaxi, we want to track the exact route using GPS coordinates , time taken and distance travelled so that SheTaxi can generate invoices to customers . As a SheTaxi cabdriver , I want to get a route map (GPS coordinates ) based on my customers destination and pickup point so that I can complete my trip ASAP. As the management of SheTaxi , we want an exclusive feature for our VIP customers, an option to book cab drivers with rating 4+ so that we can retain our VIP customers. » C XPIndia2016 10
  • 11. As a customer of SheTaxi , I want my invoice be emailed so that I need not ask for a written invoice. As the management of SheTaxi , I want to access previous trip data for each drivers so that we can make weekly payments to them As the management of SheTaxi , we want an exclusive feature for our VIP customers, an option to integrate their invoices to ” www.expensify.com” » D XPIndia2016 11
  • 12. Example : Super Market I 'am using a simple example to explain the problem , same is applicable for bigger complex systems The super market has many products to sell Each product has a  quality  cost The rules for computation of Quality and Cost are different for each product Abstract Product computeQuality() computeCost () Concreate product 1 Concreate product 2 Concreate product n-1 Concreate product N Example of a concreate product XPIndia2016 12
  • 13. Is this the best design ? Onion computeQuality() computeCost () »Is this following SRP ? Single responsibility principle »SRP : A class should have only one reason to change »What if the pricing strategy of a product varies from time to time ? XPIndia2016 13
  • 14. How about a different design Abstract Product Pricing strategy computeQuality() Concreate product 1 Concreate product 2 Concreate product n-1 Concreate product N PricingStrategy CompteCost() Strategy 1 Strategy 2 Strategy 3 XPIndia2016 14
  • 15. Another design Product PricingStrategy QualityRule PricingStrategy CompteCost() Strategy 1 Strategy 2 Strategy 3 QualityRule Quality() Rule 1 Rule 2 XPIndia2016 15
  • 16. Which design is better ? XPIndia2016 16
  • 17. Which design is better ? Answer is : it depends Dependents on what ? Lest try to define this context Context XPIndia2016 17
  • 18. Which design is better ? If mostly we will be only adding / removing products XPIndia2016 18
  • 19. Which design is better ? • We will be constantly adding new products , also • We need to modify pricing strategy every now and then for existing products XPIndia2016 19
  • 20. Which design is better ? • We need to often modify both pricing strategy & quality rule for existing products XPIndia2016 20
  • 21. There is nothing like a good or bad design we can only evaluate a design once we associate it with a context The context is the actual business problem we need to solve XPIndia2016 21
  • 22. Coordinate geometry package Graphics rendering package Core library Team BTeam A XPIndia2016 22
  • 23. Coordinate geometry package Graphics rendering package Team A Team B float x , float y , float length, float breath Line getDiagonal() Float getDistanceFromPoint(Point) Void transform(Matrix) Float getSurfaceArea………… float x , float y , float length, float breath Image Texture; Line get Diagonal () Matrix Convert (matrix) Float getDistanceFromPoint(Point) Void transform(Matrix) Float getSurfaceArea Void Scale (int x) Void deform (matrix) float x , float y , float length, float breath , int height , int width Image Texture; Line get Diagonal() Matrix Convert (matrix) Float getDistanceFromPoint(Point) Void transform(Matrix) Float getSurfaceArea Void Scale (int x) Void deform (matrix) »The dirty evolution of rectangle class XPIndia2016 23
  • 24. Coordinate geometry package Graphics rendering package Core library Team BTeam A XPIndia2016 24
  • 25. If design reuse is done incorrectly it could slowly , unknowingly contaminate the entire system XPIndia2016 25
  • 27. Which design decision is better to store cab locations in real time ? XPIndia2016 27 » Accuracy ++ » Complexity++ » Retrieval performance –- » Shortest route++ » Accuracy -- » Simplicity ++ » Retrieval performance++ » Shortest route --
  • 28. • Design reuse is always good • Software design should always strive towards perfection XPIndia2016 28 Myths
  • 29. Domain , sub domain and Bounded Context XPIndia2016 29
  • 31. Bounded Context is an explicit boundary within which a domain model exists XPIndia2016 31
  • 32. • Design reuse is always good within its bounded context • Software design should always strive towards perfection with in its bounded context XPIndia2016 32
  • 33. Let apply what we learned and redesign XPIndia2016 33
  • 35. Domain Driven Design what we didn’t cover XPIndia2016 35 • Entity • Value Object • Aggregate • Domain Event • Service • Repository • Factory » Ubiquitous language
  • 36. If your bitten by the DDD bug you have two choices ,the blue pill or the red pill XPIndia2016 36
  • 38. Domain Driven Design what we didn’t cover XPIndia2016 38