SlideShare ist ein Scribd-Unternehmen logo
1 von 64
Downloaden Sie, um offline zu lesen
Domain Driven Design
Nikolay	
  Vasilev	
  
Domain Driven Design
•  Status	
  Quo	
  of	
  building	
  Enterprise	
  Applica;ons	
  (EA)	
  
•  What	
  is	
  DDD?	
  
•  Strategic	
  DDD	
  
•  Tac;cal	
  DDD	
  (a.k.a.	
  DDD-­‐Lite)	
  
•  Code	
  /	
  Example	
  
•  Ques;ons	
  
•  Resources	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 2
Status Quo of building Enterprise
Applications (EA)
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Status Quo of building EA
•  How	
  would	
  you	
  build	
  an	
  EA?	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 4
Status Quo of building EA
•  How	
  would	
  you	
  build	
  an	
  EA?	
  
–  Layered	
  Architecture	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 5
Persistence	
  
Domain	
  
Presenta;on	
  
Status Quo of building EA
•  How	
  would	
  you	
  build	
  an	
  EA?	
  
–  Layered	
  Architecture	
  
•  Domain	
  Layer:	
  How	
  to	
  organize	
  it?	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 6
Persistence	
  
Domain	
  
Presenta;on	
  
Status Quo of building EA
•  How	
  would	
  you	
  build	
  an	
  EA?	
  
–  Layered	
  Architecture	
  
•  Domain	
  Layer:	
  How	
  to	
  organize	
  it?	
  
•  Three	
  Standard	
  PaPerns	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 7
Persistence	
  
Domain	
  
Presenta;on	
  
Status Quo of building EA
•  Transac;on	
  Script	
  
–  Express	
  business	
  logic	
  via	
  procedures	
  
–  Easy	
  to	
  grasp	
  and	
  to	
  avoid	
  performance	
  problems	
  
	
  
•  Domain	
  Model	
  
–  Object	
  model	
  of	
  domain,	
  having	
  both	
  –	
  behaviour	
  	
  
and	
  data	
  
–  Expressive	
  but	
  elaborated	
  
•  Table	
  Module	
  
–  middle	
  ground	
  between	
  the	
  two	
  above	
  
–  one	
  class	
  per	
  db	
  table	
  with	
  procedures	
  over	
  the	
  data	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 8
Persistence	
  
Domain	
  
Presenta;on	
  
Status Quo of building EA
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 9
Source:	
  [Fowler,	
  PoEAA]	
  
Status Quo of building EA
•  How	
  Spring	
  MVC	
  does	
  the	
  work?	
  
•  The	
  result:	
  
–  Thinking	
  in	
  technical	
  terms,	
  not	
  domain’s	
  one	
  
–  Anemic	
  Domain	
  Model	
  (POJO’s	
  with	
  no	
  behaviour)	
  
–  Boilerplate	
  Services	
  layer	
  with	
  too	
  many	
  responsibili;es	
  
–  No	
  separa;on	
  of	
  (domain)	
  concerns	
  
	
  
•  Accept	
  it	
  my	
  friend,	
  it’s	
  pure	
  Transac;on	
  Script	
  in	
  ac;on!	
  	
  
–  i.e.	
  Procedural	
  Programming	
  disguised	
  as	
  OOP	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 10
Controller	
   Service	
   DAO	
   DTO	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
What is DDD?
What is DDD?
•  What	
  is	
  DDD?	
  
–  Not	
  a	
  Technology	
  or	
  Methodology	
  
–  Set	
  of	
  principles	
  and	
  paPerns	
  for	
  focusing	
  the	
  design	
  effort	
  where	
  it	
  maPers	
  most	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 12
What is DDD?
•  What	
  is	
  DDD?	
  
–  Not	
  a	
  Technology	
  or	
  Methodology	
  
–  Set	
  of	
  principles	
  and	
  paPerns	
  for	
  focusing	
  the	
  design	
  effort	
  where	
  it	
  maPers	
  most	
  
•  It’s	
  all	
  about…	
  
–  Understanding	
  of	
  the	
  domain	
  (subject	
  area)	
  	
  
where	
  the	
  soaware	
  will	
  be	
  applied	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 13
HOW	
  DOES	
  IT	
  WORK?	
  
What is DDD?
•  What	
  is	
  DDD?	
  
–  Not	
  a	
  Technology	
  or	
  Methodology	
  
–  Set	
  of	
  principles	
  and	
  paPerns	
  for	
  focusing	
  the	
  design	
  effort	
  where	
  it	
  maPers	
  most	
  
•  It’s	
  all	
  about…	
  
–  Understanding	
  of	
  the	
  domain	
  (subject	
  area)	
  	
  
where	
  the	
  soaware	
  will	
  be	
  applied	
  
	
  
–  Create	
  highly	
  expressive	
  model	
  of	
  that	
  domain	
  
	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 14
HOW	
  DOES	
  IT	
  WORK?	
  
BUILD	
  A	
  MODEL	
  
What is DDD?
•  What	
  is	
  DDD?	
  
–  Not	
  a	
  Technology	
  or	
  Methodology	
  
–  Set	
  of	
  principles	
  and	
  paPerns	
  for	
  focusing	
  the	
  design	
  effort	
  where	
  it	
  maPers	
  most	
  
•  It’s	
  all	
  about…	
  
–  Understanding	
  of	
  the	
  domain	
  (subject	
  area)	
  	
  
where	
  the	
  soaware	
  will	
  be	
  applied	
  
	
  
–  Create	
  highly	
  expressive	
  model	
  of	
  that	
  domain	
  
	
  
–  Dis;l	
  Ubiquitous	
  Language	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 15
HOW	
  DOES	
  IT	
  WORK?	
  
BUILD	
  A	
  MODEL	
  
GROW	
  A	
  LANGUAGE	
  
What is a Model?
•  What	
  is	
  a	
  Model?	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 16
What is a Model?
•  What	
  is	
  a	
  Model?	
  
–  Simplifica;on	
  of	
  reality	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 17
What is a Model?
•  What	
  is	
  a	
  Model?	
  
–  Simplifica;on	
  of	
  reality	
  
–  Shows	
  some	
  aspect	
  of	
  reality…	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 18
What is a Model?
•  What	
  is	
  a	
  Model?	
  
–  Simplifica;on	
  of	
  reality	
  
–  Shows	
  some	
  aspect	
  of	
  reality…	
  
–  …	
  or	
  an	
  idea	
  that	
  is	
  of	
  interest	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 19
What is a Model?
•  How	
  do	
  you	
  represent	
  your	
  Model?	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 20
(UML)	
  DIAGRAMS?	
  
What is a Model?
•  How	
  do	
  you	
  represent	
  your	
  Model?	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 21
TEXT?	
  
Ingest	
  engineer	
  manages	
  brands	
  
As	
  an	
  ingest	
  engineer	
  
I	
  want	
  to	
  ingest	
  brands,	
  series	
  and	
  episodes	
  
So	
  that	
  users	
  could	
  browse	
  them	
  
Scenario	
  1:	
  Episodes	
  IngesKon	
  
Given	
  a	
  brand	
  	
  with	
  one	
  series	
  
When	
  I	
  ingest	
  an	
  episode	
  
Then	
  its	
  gets	
  ready	
  for	
  to	
  be	
  seen	
  
Scenario	
  2:	
  Episodes	
  are	
  seen	
  
Given	
  a	
  brand	
  	
  with	
  1	
  series	
  and	
  an	
  episode	
  
When	
  an	
  user	
  request	
  episode	
  content	
  
Then	
  she	
  is	
  able	
  to	
  see	
  it	
  
What is a Model?
•  How	
  do	
  you	
  represent	
  your	
  Model?	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 22
AUTOMATED	
  TESTS?	
  
What is a Model?
•  How	
  do	
  you	
  represent	
  your	
  Model?	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 23
CODE?	
  
What is a Model?
•  The	
  model	
  is…	
  
	
  
	
  
•  Everything	
  else	
  is…	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 24
THE	
  MENTAL	
  REPRESENTATION	
  
JUST	
  COMMUNICATION	
  TOOL	
  
Elaborate the Model
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 25
A	
  COLLABORATIVE	
  EXERCISE	
  
Elaborate the Model
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 26
BASED	
  ON	
  A	
  COMMON	
  LANGUAGE	
  
Elaborate the Model
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 27
Ingest	
  engineer	
  manages	
  brands	
  
As	
  an	
  ingest	
  engineer	
  
I	
  want	
  to	
  ingest	
  brands,	
  series	
  and	
  episodes	
  
So	
  that	
  users	
  could	
  browse	
  them	
  
EXPRESSED	
  AT	
  ALL	
  LEVELS	
  
Elaborate the Model
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 28
EVOLUTIONARY	
  PROCESS	
  
Elaborate the Model
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 29
EXPERIMENTING	
  IS	
  ESSENTIAL	
  
Elaborate the Model
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 30
SO	
  DO	
  AUTOMATED	
  TESTING	
  
Test	
  
Ubiquitous Language
	
  
	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 31
Technical	
  aspects	
  of	
  design	
  
Technical	
  terms	
  
Technical	
  design	
  paPerns	
  
Business	
  terms	
  developers	
  	
  
don’t	
  understand	
  
Business	
  terms	
  everyone	
  	
  
uses	
  that	
  don’t	
  appear	
  	
  
in	
  design	
  
Domain	
  model	
  terms	
  
Names	
  of	
  bounded	
  contexts	
  
Terminology	
  of	
  large-­‐scale	
  	
  
structure	
  
DDD	
  paPern	
  names	
  
UBIQUITOUS	
  LANGUAGE	
  
Candidates	
  to	
  fold	
  	
  
into	
  model	
  
Ubiquitous Language
Ubiquitous Language
	
  
	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 32
Application
Code
Test
Code
Specs and
documentation
Whiteboard
discussions
Domain
Expert
Analyst Developer
Developer
Strategic DDD
Domain Modelling
•  Typical	
  system	
  today	
  
–  Consist	
  of	
  a	
  few	
  subsystems,	
  responsible	
  for	
  mul;ple	
  func;ons	
  
–  Soaware/Domain	
  concerns	
  are	
  not	
  clearly	
  separated	
  	
  
	
  
•  Which	
  func;ons	
  make	
  business	
  successful?	
  
–  Think	
  about	
  each	
  of	
  them	
  separately	
  
–  Do	
  NOT	
  create	
  one	
  model	
  of	
  the	
  whole	
  domain	
  
–  Otherwise	
  everything	
  will	
  be	
  connected	
  to	
  and	
  depend	
  on	
  everything	
  else	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 34
Domain Modelling – Basic Terms
•  Domain	
  	
  
–  Subject	
  area	
  where	
  the	
  soaware	
  will	
  be	
  	
  
applied	
  
–  Example:	
  VOD	
  Domain	
  
•  Subdomain	
  
–  Logically	
  separated	
  part	
  of	
  the	
  Domain	
  
–  Example:	
  Inges;on,	
  Streaming,	
  Geo	
  Loca;on	
  
•  Domain	
  Model	
  
–  Soaware	
  model	
  for	
  solu;on	
  of	
  a	
  domain	
  	
  
problem	
  
•  Bounded	
  Context	
  
–  Explicit	
  boundary	
  where	
  Domain	
  Model	
  lives	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 35
Source:	
  [Vernon,	
  DDD]	
  
DomainSubdomain A
Subdomain B
Subdomain C
ProblemSpaceSolutionSpace
Bounded
Context A
Model
A
Bounded
Context B
Model
B
Bounded
Context C
Model
B
Problem-Solution Perspective
•  Domains	
  have	
  problems	
  space	
  and	
  solu;on	
  space	
  
•  Problem	
  Space	
  
–  Strategic	
  business	
  challenge	
  to	
  be	
  solved	
  
–  Separate	
  it	
  into	
  Subdomains	
  
•  Solu;on	
  Space	
  
–  Implementa;on	
  of	
  the	
  soaware	
  	
  
to	
  solve	
  the	
  business	
  problem	
  
–  Bounded	
  Context	
  is	
  a	
  specific	
  solu;on	
  
–  The	
  model	
  lives	
  in	
  the	
  boundaries	
  of	
  	
  
Bounded	
  Context	
  
	
  
•  When	
  you	
  have	
  good	
  understanding	
  of	
  the	
  	
  
problem	
  space,	
  turn	
  it	
  into	
  solu;on	
  space	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 36
Source:	
  [Vernon,	
  DDD]	
  
Subdomains
•  Core	
  Domain	
  
–  part	
  of	
  the	
  business	
  that	
  is	
  of	
  primary	
  	
  
importance	
  
–  Example:	
  Asset	
  Metadata	
  Delivery	
  
•  Suppor;ng	
  Domain	
  
–  models	
  some	
  aspect	
  of	
  the	
  business	
  	
  
that	
  is	
  essen;al,	
  yet	
  not	
  Core	
  
–  Example:	
  Asset	
  Streaming	
  Info	
  
•  Generic	
  Domain	
  
–  captures	
  nothing	
  special	
  to	
  the	
  	
  
business,	
  yet	
  is	
  required	
  
–  Example:	
  GeoLoca;on	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 37
SO	
  DO	
  AUTOMATED	
  TESTING	
  
Bounded Contexts
•  Models	
  are	
  developed	
  in	
  Bounded	
  Contexts	
  
•  Linguis;c	
  boundary	
  in	
  which	
  the	
  model	
  exists	
  
–  Mark	
  off	
  where	
  the	
  meaning	
  of	
  every	
  term	
  used	
  by	
  the	
  domain	
  model	
  is	
  well	
  
understood	
  
–  Example:	
  User	
  (Auth	
  Context:	
  Role)	
  and	
  User	
  (VOD	
  Context:	
  Content	
  Customer)	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 38
User
- role: Admin
- subscription: Series
Auth Context VOD Context
Bounded Contexts
•  APempt	
  to	
  align	
  subdomains	
  one-­‐to-­‐one	
  with	
  Bounded	
  Contexts	
  
•  Could	
  influence	
  how	
  teams	
  are	
  organized	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 39
OrganizationLevelContextLevel
Context A
Context B
Context Mapping
•  Mapping	
  the	
  contact	
  points	
  and	
  transla;ons	
  between	
  Bounded	
  Contexts	
  
•  Context	
  Mapping	
  PaPerns	
  
–  Shared	
  Kernel	
  
•  Shared	
  Subset	
  of	
  Domain	
  
•  Example:	
  Money	
  
–  Customer/Supplier	
  
•  Upstream	
  Project	
  –	
  Supplier	
  Team	
  
•  Downstream	
  Project	
  –	
  Consumer	
  
Team	
  
•  Acceptance	
  test	
  at	
  Upstream	
  	
  
context	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 40
Context A Context B
Context A Context B
Uses agreed
interfaces
UD
Context B
Context Mapping
•  Context	
  Mapping	
  PaPerns	
  
–  Conformist	
  
–  An;-­‐Corrup;on	
  Layer	
  (ACL)	
  
•  Isola;ng	
  Layer	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 41
Context A
Context A Context B
Conform to existing
interfaces
UD
Adaptor1
Service1
Service2
Facade
Adaptor1
Translator2
Translator1
ACL
UD
Context Mapping
•  Context	
  Mapping	
  PaPerns	
  
–  Separate	
  Ways	
  
–  Open	
  Host	
  Service	
  (OHS)	
  
•  a.k.a.	
  “Remote	
  Façade”	
  	
  
•  Example:	
  REST	
  interface	
  
–  Published	
  Language	
  (PL)	
  
•  Example:	
  XML,	
  JSON	
  
–  Big	
  Ball	
  of	
  Mud	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 42
Context A Context B
Context Mapping
•  So,	
  how	
  does	
  it	
  work?	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 43
Generic Domain
Context
Subdomain Context
Core Domain Context
U
D
OHS / PL
ACL
U
D
OHS / PL
ACL
U
D
OHS / PL
ACL
Context Mapping
•  So,	
  how	
  does	
  it	
  work?	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 44
ContextA
Context B
Adapter
Application Service
Resource (REST)
/ OHS
HTTP Client (Façade)
Translator
ACL
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Tactical DDD (DDD-Lite)
Source:	
  [Evans,	
  DDD]	
  
Layered Architecture
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  
	
  	
  	
  	
  The	
  DDD-­‐Lite	
  is	
  applied	
  in	
  Domain	
  Layer	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 46
Entity
•  A.k.a.	
  “Reference	
  Object”	
  
•  Has	
  Iden;ty	
  and	
  State	
  
•  May	
  have	
  mul;ple	
  representa;ons	
  
–  Example:	
  book	
  through	
  a	
  publishing	
  process	
  
•  Not	
  defined	
  primarily	
  by	
  their	
  aPributes	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 47
SO	
  DO	
  AUTOMATED	
  TESTING	
  
Value Object
•  Have	
  no	
  iden;ty	
  
•  Defined	
  by	
  its	
  aPributes	
  
•  Used	
  to	
  describe	
  the	
  state	
  of	
  En;ty	
  
–  as	
  its	
  aPribute	
  
•  Immutable	
  	
  
–  Replacement	
  rather	
  than	
  	
  
modifica;on	
  
•  Could	
  be	
  implemented	
  as	
  	
  
Flyweight	
  [GoF]	
  
•  Example:	
  Colours,	
  Money,	
  Time	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 48
SO	
  DO	
  AUTOMATED	
  TESTING	
  
Services
•  Opera;on	
  which	
  does	
  not	
  conceptually	
  belongs	
  to	
  an	
  En;ty	
  or	
  Value	
  Object	
  
•  Fine-­‐grained	
  domain	
  opera;on	
  over	
  domain	
  objects	
  
–  Usage:	
  Calcula;on,	
  transforma;on	
  etc.	
  
•  Domain	
  level	
  –	
  no	
  applica;on,	
  infrastructure	
  etc.	
  
•  Stateless	
  
•  Usually	
  Singletons	
  [GoF]	
  
•  Example:	
  	
  
–  Triggers	
  En;ty	
  consistency	
  valida;on	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 49
SO	
  DO	
  AUTOMATED	
  TESTING	
  
Domain Event
•  Event	
  is	
  something	
  that	
  happened	
  in	
  the	
  domain	
  	
  
•  Purpose:	
  to	
  makes	
  a	
  change	
  of	
  state	
  explicit	
  
•  Immutable	
  (it	
  happened	
  in	
  the	
  past)	
  
•  Data	
  holding	
  structure	
  (POJO)	
  
•  Class	
  naming	
  –	
  command	
  happened	
  in	
  the	
  past	
  
–  Example:	
  BrandRenamed	
  
•  Publish-­‐Subscribe	
  (a.k.a.	
  Observer	
  [GoF])	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 50
Module
•  A.k.a.	
  packages	
  
•  Divide	
  code	
  by	
  concepts	
  (not	
  by	
  technical	
  criteria)	
  
•  There	
  is	
  limit	
  to	
  how	
  many	
  things	
  a	
  person	
  can	
  think	
  about	
  at	
  once	
  (low	
  coupling)	
  
•  Choose	
  Modules	
  that	
  tell	
  the	
  story	
  of	
  the	
  system	
  
•  Example:	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 51
SO	
  DO	
  AUTOMATED	
  TESTING	
  
[tld].[bounded-context-name].domain.[model | service|…].[conceptname]
com.piksel.vod.domain.model
com.piksel.auth.domain.model
com.piksel.vod.domain.model.assets
com.piksel.vod.domain.service
com.piksel.vod.resources.view
Aggregate
•  A	
  cluster	
  of	
  associated	
  objects	
  (En;;es	
  and	
  Value	
  Objects	
  usually)	
  	
  
treated	
  as	
  a	
  unit	
  for	
  the	
  purpose	
  of	
  data	
  changes	
  
•  Root	
  (En;ty)	
  	
  
•  Boundary	
  (what	
  is	
  inside	
  the	
  Aggregate)	
  
•  Enforces	
  invariants	
  (business	
  rules	
  which	
  should	
  be	
  always	
  consistent)	
  
•  Only	
  Aggregate’s	
  root	
  could	
  be	
  referenced	
  from	
  outside	
  objects	
  
•  Domain	
  Events	
  emission	
  
–  On	
  change	
  for	
  the	
  Aggregate	
  
•  Aggregate	
  Stores	
  	
  
–  NoSQL	
  Key-­‐Value/Document	
  Stores	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 52
Factory
•  Constructors	
  -­‐	
  “primi;ve	
  level	
  of	
  instance	
  crea;on…	
  for	
  the	
  programming	
  
language”,	
  Evans	
  
–  use	
  only	
  for	
  very	
  simple	
  objects	
  -­‐	
  straighlorward	
  construc;on!	
  
•  Crea;on	
  of	
  complex	
  En;;es/Value	
  Objects	
  
•  Implementa;on	
  -­‐	
  various	
  crea;onal	
  (GoF)	
  	
  
paPerns	
  	
  
–  Factory	
  Method	
  
–  Abstract	
  Factory	
  	
  
–  Builder	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 53
Repository
•  A	
  contract	
  between	
  applica;on	
  and	
  data	
  storage,	
  that	
  speaks	
  UL	
  
•  Repository	
  per	
  Aggregate	
  
•  Pretends	
  to	
  be	
  a	
  collec;on	
  of	
  Aggregate	
  Roots	
  
•  Isolates	
  Domain	
  Layer	
  from	
  persistence	
  details	
  
•  Uses	
  Factory	
  when	
  storing	
  new	
  object	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 54
Source:	
  [Evans,	
  DDD]	
  
Repository
•  Uses	
  Factory	
  when	
  recons;tutes	
  preexis;ng	
  object	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 55
Source:	
  [Evans,	
  DDD]	
  
Specification
•  Makes	
  implicit	
  business	
  rules	
  explicit	
  
•  It’s	
  a	
  predicate	
  
•  Allows	
  crea;on	
  of	
  Compound	
  Specifica;ons	
  (	
  using	
  NOT,	
  AND,	
  OR,	
  etc.)	
  
•  Used	
  for:	
  
–  Valida;on	
  
–  Selec;on	
  /	
  Queries	
  (by	
  Repository)	
  
–  Building	
  (Genera;on)	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 56
Source:	
  [Evans,	
  DDD]	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Code / Example
Code / Example
•  Example	
  project	
  
–  DDD-­‐CQRS	
  Sample,	
  (v.02)	
  
–  HLA:	
   	
   	
   	
  h'p://prezi.com/akrfq7jyau8w/ddd-­‐cqrs-­‐leaven-­‐v20/	
  
–  Code	
  base:	
   	
   	
  h'ps://github.com/Bo'egaIT/ddd-­‐leaven-­‐v2	
  	
  
–  User	
  Group: 	
   	
  h'ps://groups.google.com/forum/#!forum/ddd-­‐cqrs-­‐sample	
  
•  More	
  projects	
  on	
  official	
  CQRS	
  site	
  
–  hPp://cqrs.wordpress.com/examples/	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 58
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Questions?
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 60
Thank	
  you	
  for	
  your	
  aPen;on!	
  
Resources
Resources
•  [Evans,	
  DDD]	
  "Domain-­‐Driven	
  Design:	
  Tackling	
  Complexity	
  in	
  the	
  Heart	
  of	
  Soaware",	
  Eric	
  
Evans,	
  Addison	
  Wesley,	
  20/08/2003,	
  ISBN:	
  0-­‐321-­‐12521-­‐5	
  
•  [Vernon,	
  DDD],	
  "Implemen;ng	
  Domain-­‐Driven	
  Design",	
  Vaughn	
  Vernon,	
  2013,	
  	
  	
  	
  	
  ISBN-­‐10:	
  
0-­‐321-­‐83457-­‐7,	
  ISBN-­‐13:	
  978-­‐0-­‐321-­‐83457-­‐7	
  
•  [Fowler,	
  PoEAA]	
  "PaPerns	
  of	
  Enterprise	
  Applica;on	
  Architecture",	
  	
  Mar;n	
  Fowler,	
  Dave	
  Rice,	
  
MaPhew	
  Foemmel,	
  Edward	
  HieaP,	
  Robert	
  Mee,	
  Randy	
  Stafford),	
  05/11/2002,	
  ISBN:	
  
0-­‐321-­‐12742-­‐0	
  
•  [Fowler,	
  NoSQL]	
  "NoSQL	
  Dis;lled",	
  Mar;n	
  Fowler,	
  08/11/2012,	
  ISBN-­‐10:	
  0-­‐321-­‐82662-­‐0,	
  
ISBN-­‐13:	
  978-­‐0-­‐321-­‐82662-­‐6	
  
•  [GoF,	
  DP]	
  "Design	
  PaPerns:	
  Elements	
  of	
  Reusable	
  Object-­‐Oriented	
  Soaware",	
  	
  Erich	
  Gamma	
  ,	
  
Richard	
  Helm	
  ,	
  Ralph	
  Johnson	
  ,	
  John	
  Vlissides,10/11/1994,	
  ISBN-­‐10:	
  0201633612,	
  ISBN-­‐13:	
  
078-­‐5342633610	
  
•  [Fowler,	
  NoSQL	
  talk]	
  "NoSQL	
  maPers	
  Cologne	
  2013	
  -­‐	
  Key	
  Note:	
  NoSQL	
  Dis;lled	
  to	
  an	
  hour	
  -­‐	
  
Mar;n	
  Fowler",	
  Mar;n	
  Fowler,	
  2013,	
  h'p://vimeo.com/66052102	
  	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 62
Resources
•  [Khan,	
  DDD]	
  "Gexng	
  Started	
  with	
  Domain-­‐Driven	
  Design",	
  Aslam	
  Khan,	
  	
  	
  	
  	
  h'p://
refcardz.dzone.com/refcardz/geLng-­‐started-­‐domain-­‐driven	
  	
  
•  [Brandolini,	
  DDD	
  ContextMapping]	
  "Strategic	
  Domain	
  Driven	
  Design	
  with	
  Context	
  Mapping",	
  
Alberto	
  Brandolini,	
  25/11/2009,	
  h'p://www.infoq.com/arMcles/ddd-­‐contextmapping	
  	
  
•  [Riley,	
  DDD],	
  "Domain	
  Driven	
  Design",	
  Ryan	
  Riley,	
  22/10/2009,	
  h'p://www.slideshare.net/
panesofglass/domain-­‐driven-­‐design	
  	
  
•  [Ferguson	
  ,	
  DDD],	
  "Domain	
  Driven	
  Design",	
  John	
  Ferguson	
  Smart,	
  24/08/2011,	
  h'p://
www.slideshare.net/wakaleo/introducMon-­‐toddd	
  
•  [Sizovs,	
  DDD]	
  "Introduc;on	
  to	
  DDD",	
  Eduards	
  Sizovs,	
  25/10/2012,	
  h'p://
www.slideshare.net/eduardsi/introducMon-­‐to-­‐ddd	
  
•  Domain	
  Driven	
  Design	
  Website,	
  h'p://domaindrivendesign.org/	
  
•  DDD	
  User	
  Group,	
  h'p://tech.groups.yahoo.com/group/domaindrivendesign/	
  
•  DDD	
  Community,	
  h'p://dddcommunity.org/	
  
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 63
Bulgarian Java User Group
Nikolay Vasilev, CC BY-SA 3.0
Domain Driven Design Page 64

Weitere ähnliche Inhalte

Was ist angesagt?

Domain-Driven Design
Domain-Driven DesignDomain-Driven Design
Domain-Driven DesignAndriy Buday
 
Domain Driven Design: Zero to Hero
Domain Driven Design: Zero to HeroDomain Driven Design: Zero to Hero
Domain Driven Design: Zero to HeroFabrício Rissetto
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introductionwojtek_s
 
Domain Driven Design Quickly
Domain Driven Design QuicklyDomain Driven Design Quickly
Domain Driven Design QuicklyMariam Hakobyan
 
Domain Driven Design (Ultra) Distilled
Domain Driven Design (Ultra) DistilledDomain Driven Design (Ultra) Distilled
Domain Driven Design (Ultra) DistilledNicola Costantino
 
Domain driven design
Domain driven designDomain driven design
Domain driven designits_skm
 
A Practical Guide to Domain Driven Design: Presentation Slides
A Practical Guide to Domain Driven Design: Presentation SlidesA Practical Guide to Domain Driven Design: Presentation Slides
A Practical Guide to Domain Driven Design: Presentation Slidesthinkddd
 
Domain driven design and model driven development
Domain driven design and model driven developmentDomain driven design and model driven development
Domain driven design and model driven developmentDmitry Geyzersky
 
Domain-Driven Design with ASP.NET MVC
Domain-Driven Design with ASP.NET MVCDomain-Driven Design with ASP.NET MVC
Domain-Driven Design with ASP.NET MVCSteven Smith
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven DesignYoung-Ho Cho
 
Agile, User Stories, Domain Driven Design
Agile, User Stories, Domain Driven DesignAgile, User Stories, Domain Driven Design
Agile, User Stories, Domain Driven DesignAraf Karsh Hamid
 
Refactoring for Domain Driven Design
Refactoring for Domain Driven DesignRefactoring for Domain Driven Design
Refactoring for Domain Driven DesignDavid Berliner
 
Implementing Domain-Driven Design (Study Group) Chapter 3 - Context Maps
Implementing Domain-Driven Design (Study Group) Chapter 3 - Context Maps Implementing Domain-Driven Design (Study Group) Chapter 3 - Context Maps
Implementing Domain-Driven Design (Study Group) Chapter 3 - Context Maps Eason Kuo
 
Modelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven DesignModelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven DesignNaeem Sarfraz
 
How to Implement Domain Driven Design in Real Life SDLC
How to Implement Domain Driven Design  in Real Life SDLCHow to Implement Domain Driven Design  in Real Life SDLC
How to Implement Domain Driven Design in Real Life SDLCAbdul Karim
 
DDD Tactical Design with Clean Architecture - Ivan Paulovich
DDD Tactical Design with Clean Architecture - Ivan PaulovichDDD Tactical Design with Clean Architecture - Ivan Paulovich
DDD Tactical Design with Clean Architecture - Ivan PaulovichIvan Paulovich
 

Was ist angesagt? (20)

Domain-Driven Design
Domain-Driven DesignDomain-Driven Design
Domain-Driven Design
 
Domain Driven Design: Zero to Hero
Domain Driven Design: Zero to HeroDomain Driven Design: Zero to Hero
Domain Driven Design: Zero to Hero
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introduction
 
Introduction to DDD
Introduction to DDDIntroduction to DDD
Introduction to DDD
 
Domain Driven Design Quickly
Domain Driven Design QuicklyDomain Driven Design Quickly
Domain Driven Design Quickly
 
Domain Driven Design (Ultra) Distilled
Domain Driven Design (Ultra) DistilledDomain Driven Design (Ultra) Distilled
Domain Driven Design (Ultra) Distilled
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
 
A Practical Guide to Domain Driven Design: Presentation Slides
A Practical Guide to Domain Driven Design: Presentation SlidesA Practical Guide to Domain Driven Design: Presentation Slides
A Practical Guide to Domain Driven Design: Presentation Slides
 
Domain driven design and model driven development
Domain driven design and model driven developmentDomain driven design and model driven development
Domain driven design and model driven development
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
 
Domain-Driven Design with ASP.NET MVC
Domain-Driven Design with ASP.NET MVCDomain-Driven Design with ASP.NET MVC
Domain-Driven Design with ASP.NET MVC
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Agile, User Stories, Domain Driven Design
Agile, User Stories, Domain Driven DesignAgile, User Stories, Domain Driven Design
Agile, User Stories, Domain Driven Design
 
Refactoring for Domain Driven Design
Refactoring for Domain Driven DesignRefactoring for Domain Driven Design
Refactoring for Domain Driven Design
 
Implementing Domain-Driven Design (Study Group) Chapter 3 - Context Maps
Implementing Domain-Driven Design (Study Group) Chapter 3 - Context Maps Implementing Domain-Driven Design (Study Group) Chapter 3 - Context Maps
Implementing Domain-Driven Design (Study Group) Chapter 3 - Context Maps
 
Modelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven DesignModelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven Design
 
How to Implement Domain Driven Design in Real Life SDLC
How to Implement Domain Driven Design  in Real Life SDLCHow to Implement Domain Driven Design  in Real Life SDLC
How to Implement Domain Driven Design in Real Life SDLC
 
DDD Tactical Design with Clean Architecture - Ivan Paulovich
DDD Tactical Design with Clean Architecture - Ivan PaulovichDDD Tactical Design with Clean Architecture - Ivan Paulovich
DDD Tactical Design with Clean Architecture - Ivan Paulovich
 

Andere mochten auch

Domain Driven Design Through Onion Architecture
Domain Driven Design Through Onion ArchitectureDomain Driven Design Through Onion Architecture
Domain Driven Design Through Onion ArchitectureBoldRadius Solutions
 
The Architecture of an API Platform
The Architecture of an API PlatformThe Architecture of an API Platform
The Architecture of an API PlatformJohannes Ridderstedt
 
Applying Domain-Driven Design to APIs and Microservices - Austin API Meetup
Applying Domain-Driven Design to APIs and Microservices  - Austin API MeetupApplying Domain-Driven Design to APIs and Microservices  - Austin API Meetup
Applying Domain-Driven Design to APIs and Microservices - Austin API MeetupLaunchAny
 
Onion Architecture
Onion ArchitectureOnion Architecture
Onion Architecturematthidinger
 
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...CA API Management
 
Domain Driven Design using Laravel
Domain Driven Design using LaravelDomain Driven Design using Laravel
Domain Driven Design using Laravelwajrcs
 
Api architectures for the modern enterprise
Api architectures for the modern enterpriseApi architectures for the modern enterprise
Api architectures for the modern enterpriseCA API Management
 
Designing APIs and Microservices Using Domain-Driven Design
Designing APIs and Microservices Using Domain-Driven DesignDesigning APIs and Microservices Using Domain-Driven Design
Designing APIs and Microservices Using Domain-Driven DesignLaunchAny
 
Software Design Patterns in Laravel by Phill Sparks
Software Design Patterns in Laravel by Phill SparksSoftware Design Patterns in Laravel by Phill Sparks
Software Design Patterns in Laravel by Phill SparksPhill Sparks
 

Andere mochten auch (9)

Domain Driven Design Through Onion Architecture
Domain Driven Design Through Onion ArchitectureDomain Driven Design Through Onion Architecture
Domain Driven Design Through Onion Architecture
 
The Architecture of an API Platform
The Architecture of an API PlatformThe Architecture of an API Platform
The Architecture of an API Platform
 
Applying Domain-Driven Design to APIs and Microservices - Austin API Meetup
Applying Domain-Driven Design to APIs and Microservices  - Austin API MeetupApplying Domain-Driven Design to APIs and Microservices  - Austin API Meetup
Applying Domain-Driven Design to APIs and Microservices - Austin API Meetup
 
Onion Architecture
Onion ArchitectureOnion Architecture
Onion Architecture
 
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...
 
Domain Driven Design using Laravel
Domain Driven Design using LaravelDomain Driven Design using Laravel
Domain Driven Design using Laravel
 
Api architectures for the modern enterprise
Api architectures for the modern enterpriseApi architectures for the modern enterprise
Api architectures for the modern enterprise
 
Designing APIs and Microservices Using Domain-Driven Design
Designing APIs and Microservices Using Domain-Driven DesignDesigning APIs and Microservices Using Domain-Driven Design
Designing APIs and Microservices Using Domain-Driven Design
 
Software Design Patterns in Laravel by Phill Sparks
Software Design Patterns in Laravel by Phill SparksSoftware Design Patterns in Laravel by Phill Sparks
Software Design Patterns in Laravel by Phill Sparks
 

Ähnlich wie Domain Driven Design

VS Code and Modern Development Environment Preview
VS Code and Modern Development Environment PreviewVS Code and Modern Development Environment Preview
VS Code and Modern Development Environment PreviewRoberto Stefanetti
 
Blazing fast web experience at your fingertips with Experience Edge, JSS for ...
Blazing fast web experience at your fingertips with Experience Edge, JSS for ...Blazing fast web experience at your fingertips with Experience Edge, JSS for ...
Blazing fast web experience at your fingertips with Experience Edge, JSS for ...VarunNehra
 
Experience Edge at Scale: Implementing the Sitecore Composable Stack
Experience Edge at Scale: Implementing the Sitecore Composable StackExperience Edge at Scale: Implementing the Sitecore Composable Stack
Experience Edge at Scale: Implementing the Sitecore Composable StackJeffrey Rondeau
 
Day One Keynote
Day One KeynoteDay One Keynote
Day One Keynotegoodfriday
 
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?Peter Procházka
 
Day One Keynote
Day One KeynoteDay One Keynote
Day One Keynotegoodfriday
 
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?Peter Procházka
 
Angular - Chapter 1 - Introduction
 Angular - Chapter 1 - Introduction Angular - Chapter 1 - Introduction
Angular - Chapter 1 - IntroductionWebStackAcademy
 
Building an E-commerce website in MEAN stack
Building an E-commerce website in MEAN stackBuilding an E-commerce website in MEAN stack
Building an E-commerce website in MEAN stackdivyapisces
 
SUGCON: The Agile Nirvana of DevSecOps and Containerization
SUGCON: The Agile Nirvana of DevSecOps and ContainerizationSUGCON: The Agile Nirvana of DevSecOps and Containerization
SUGCON: The Agile Nirvana of DevSecOps and ContainerizationVasiliy Fomichev
 
4Ward Company Presentation
4Ward Company Presentation4Ward Company Presentation
4Ward Company Presentation4Ward
 
Netbeans65 Osum Slides
Netbeans65 Osum SlidesNetbeans65 Osum Slides
Netbeans65 Osum SlidesAbhishek Gupta
 
Measure and Increase Developer Productivity with Help of Serverless at JCON 2...
Measure and Increase Developer Productivity with Help of Serverless at JCON 2...Measure and Increase Developer Productivity with Help of Serverless at JCON 2...
Measure and Increase Developer Productivity with Help of Serverless at JCON 2...Vadym Kazulkin
 
Are Frameworks Evil; Should you care about Sitecore SXA and JSS;.pdf
Are Frameworks Evil; Should you care about Sitecore SXA and JSS;.pdfAre Frameworks Evil; Should you care about Sitecore SXA and JSS;.pdf
Are Frameworks Evil; Should you care about Sitecore SXA and JSS;.pdfPeter Procházka
 
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?Peter Procházka
 
Acquia Platform Update: New Features and Capabilities
Acquia Platform Update: New Features and CapabilitiesAcquia Platform Update: New Features and Capabilities
Acquia Platform Update: New Features and CapabilitiesAcquia
 
Measure and Increase Developer Productivity with Help of Serverless at AWS Co...
Measure and Increase Developer Productivity with Help of Serverless at AWS Co...Measure and Increase Developer Productivity with Help of Serverless at AWS Co...
Measure and Increase Developer Productivity with Help of Serverless at AWS Co...Vadym Kazulkin
 
Angular JS - Develop Responsive Single Page Application
Angular JS - Develop Responsive Single Page ApplicationAngular JS - Develop Responsive Single Page Application
Angular JS - Develop Responsive Single Page ApplicationEdureka!
 

Ähnlich wie Domain Driven Design (20)

CQRS and Event Sourcing
CQRS and Event SourcingCQRS and Event Sourcing
CQRS and Event Sourcing
 
VS Code and Modern Development Environment Preview
VS Code and Modern Development Environment PreviewVS Code and Modern Development Environment Preview
VS Code and Modern Development Environment Preview
 
Blazing fast web experience at your fingertips with Experience Edge, JSS for ...
Blazing fast web experience at your fingertips with Experience Edge, JSS for ...Blazing fast web experience at your fingertips with Experience Edge, JSS for ...
Blazing fast web experience at your fingertips with Experience Edge, JSS for ...
 
Experience Edge at Scale: Implementing the Sitecore Composable Stack
Experience Edge at Scale: Implementing the Sitecore Composable StackExperience Edge at Scale: Implementing the Sitecore Composable Stack
Experience Edge at Scale: Implementing the Sitecore Composable Stack
 
Day One Keynote
Day One KeynoteDay One Keynote
Day One Keynote
 
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
 
Day One Keynote
Day One KeynoteDay One Keynote
Day One Keynote
 
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
 
Angular - Chapter 1 - Introduction
 Angular - Chapter 1 - Introduction Angular - Chapter 1 - Introduction
Angular - Chapter 1 - Introduction
 
Building an E-commerce website in MEAN stack
Building an E-commerce website in MEAN stackBuilding an E-commerce website in MEAN stack
Building an E-commerce website in MEAN stack
 
SUGCON: The Agile Nirvana of DevSecOps and Containerization
SUGCON: The Agile Nirvana of DevSecOps and ContainerizationSUGCON: The Agile Nirvana of DevSecOps and Containerization
SUGCON: The Agile Nirvana of DevSecOps and Containerization
 
About 4Ward
About 4WardAbout 4Ward
About 4Ward
 
4Ward Company Presentation
4Ward Company Presentation4Ward Company Presentation
4Ward Company Presentation
 
Netbeans65 Osum Slides
Netbeans65 Osum SlidesNetbeans65 Osum Slides
Netbeans65 Osum Slides
 
Measure and Increase Developer Productivity with Help of Serverless at JCON 2...
Measure and Increase Developer Productivity with Help of Serverless at JCON 2...Measure and Increase Developer Productivity with Help of Serverless at JCON 2...
Measure and Increase Developer Productivity with Help of Serverless at JCON 2...
 
Are Frameworks Evil; Should you care about Sitecore SXA and JSS;.pdf
Are Frameworks Evil; Should you care about Sitecore SXA and JSS;.pdfAre Frameworks Evil; Should you care about Sitecore SXA and JSS;.pdf
Are Frameworks Evil; Should you care about Sitecore SXA and JSS;.pdf
 
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
Are Frameworks Evil? Should you care about Sitecore SXA and JSS?
 
Acquia Platform Update: New Features and Capabilities
Acquia Platform Update: New Features and CapabilitiesAcquia Platform Update: New Features and Capabilities
Acquia Platform Update: New Features and Capabilities
 
Measure and Increase Developer Productivity with Help of Serverless at AWS Co...
Measure and Increase Developer Productivity with Help of Serverless at AWS Co...Measure and Increase Developer Productivity with Help of Serverless at AWS Co...
Measure and Increase Developer Productivity with Help of Serverless at AWS Co...
 
Angular JS - Develop Responsive Single Page Application
Angular JS - Develop Responsive Single Page ApplicationAngular JS - Develop Responsive Single Page Application
Angular JS - Develop Responsive Single Page Application
 

Kürzlich hochgeladen

Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsYoss Cohen
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...BookNet Canada
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFMichael Gough
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Karmanjay Verma
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 

Kürzlich hochgeladen (20)

Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platforms
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDF
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 

Domain Driven Design

  • 2. Domain Driven Design •  Status  Quo  of  building  Enterprise  Applica;ons  (EA)   •  What  is  DDD?   •  Strategic  DDD   •  Tac;cal  DDD  (a.k.a.  DDD-­‐Lite)   •  Code  /  Example   •  Ques;ons   •  Resources   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 2
  • 3. Status Quo of building Enterprise Applications (EA) Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0
  • 4. Status Quo of building EA •  How  would  you  build  an  EA?   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 4
  • 5. Status Quo of building EA •  How  would  you  build  an  EA?   –  Layered  Architecture   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 5 Persistence   Domain   Presenta;on  
  • 6. Status Quo of building EA •  How  would  you  build  an  EA?   –  Layered  Architecture   •  Domain  Layer:  How  to  organize  it?   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 6 Persistence   Domain   Presenta;on  
  • 7. Status Quo of building EA •  How  would  you  build  an  EA?   –  Layered  Architecture   •  Domain  Layer:  How  to  organize  it?   •  Three  Standard  PaPerns   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 7 Persistence   Domain   Presenta;on  
  • 8. Status Quo of building EA •  Transac;on  Script   –  Express  business  logic  via  procedures   –  Easy  to  grasp  and  to  avoid  performance  problems     •  Domain  Model   –  Object  model  of  domain,  having  both  –  behaviour     and  data   –  Expressive  but  elaborated   •  Table  Module   –  middle  ground  between  the  two  above   –  one  class  per  db  table  with  procedures  over  the  data   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 8 Persistence   Domain   Presenta;on  
  • 9. Status Quo of building EA Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 9 Source:  [Fowler,  PoEAA]  
  • 10. Status Quo of building EA •  How  Spring  MVC  does  the  work?   •  The  result:   –  Thinking  in  technical  terms,  not  domain’s  one   –  Anemic  Domain  Model  (POJO’s  with  no  behaviour)   –  Boilerplate  Services  layer  with  too  many  responsibili;es   –  No  separa;on  of  (domain)  concerns     •  Accept  it  my  friend,  it’s  pure  Transac;on  Script  in  ac;on!     –  i.e.  Procedural  Programming  disguised  as  OOP   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 10 Controller   Service   DAO   DTO  
  • 11. Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 What is DDD?
  • 12. What is DDD? •  What  is  DDD?   –  Not  a  Technology  or  Methodology   –  Set  of  principles  and  paPerns  for  focusing  the  design  effort  where  it  maPers  most   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 12
  • 13. What is DDD? •  What  is  DDD?   –  Not  a  Technology  or  Methodology   –  Set  of  principles  and  paPerns  for  focusing  the  design  effort  where  it  maPers  most   •  It’s  all  about…   –  Understanding  of  the  domain  (subject  area)     where  the  soaware  will  be  applied   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 13 HOW  DOES  IT  WORK?  
  • 14. What is DDD? •  What  is  DDD?   –  Not  a  Technology  or  Methodology   –  Set  of  principles  and  paPerns  for  focusing  the  design  effort  where  it  maPers  most   •  It’s  all  about…   –  Understanding  of  the  domain  (subject  area)     where  the  soaware  will  be  applied     –  Create  highly  expressive  model  of  that  domain     Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 14 HOW  DOES  IT  WORK?   BUILD  A  MODEL  
  • 15. What is DDD? •  What  is  DDD?   –  Not  a  Technology  or  Methodology   –  Set  of  principles  and  paPerns  for  focusing  the  design  effort  where  it  maPers  most   •  It’s  all  about…   –  Understanding  of  the  domain  (subject  area)     where  the  soaware  will  be  applied     –  Create  highly  expressive  model  of  that  domain     –  Dis;l  Ubiquitous  Language   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 15 HOW  DOES  IT  WORK?   BUILD  A  MODEL   GROW  A  LANGUAGE  
  • 16. What is a Model? •  What  is  a  Model?   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 16
  • 17. What is a Model? •  What  is  a  Model?   –  Simplifica;on  of  reality   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 17
  • 18. What is a Model? •  What  is  a  Model?   –  Simplifica;on  of  reality   –  Shows  some  aspect  of  reality…   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 18
  • 19. What is a Model? •  What  is  a  Model?   –  Simplifica;on  of  reality   –  Shows  some  aspect  of  reality…   –  …  or  an  idea  that  is  of  interest   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 19
  • 20. What is a Model? •  How  do  you  represent  your  Model?   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 20 (UML)  DIAGRAMS?  
  • 21. What is a Model? •  How  do  you  represent  your  Model?   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 21 TEXT?   Ingest  engineer  manages  brands   As  an  ingest  engineer   I  want  to  ingest  brands,  series  and  episodes   So  that  users  could  browse  them   Scenario  1:  Episodes  IngesKon   Given  a  brand    with  one  series   When  I  ingest  an  episode   Then  its  gets  ready  for  to  be  seen   Scenario  2:  Episodes  are  seen   Given  a  brand    with  1  series  and  an  episode   When  an  user  request  episode  content   Then  she  is  able  to  see  it  
  • 22. What is a Model? •  How  do  you  represent  your  Model?   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 22 AUTOMATED  TESTS?  
  • 23. What is a Model? •  How  do  you  represent  your  Model?   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 23 CODE?  
  • 24. What is a Model? •  The  model  is…       •  Everything  else  is…   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 24 THE  MENTAL  REPRESENTATION   JUST  COMMUNICATION  TOOL  
  • 25. Elaborate the Model Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 25 A  COLLABORATIVE  EXERCISE  
  • 26. Elaborate the Model Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 26 BASED  ON  A  COMMON  LANGUAGE  
  • 27. Elaborate the Model Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 27 Ingest  engineer  manages  brands   As  an  ingest  engineer   I  want  to  ingest  brands,  series  and  episodes   So  that  users  could  browse  them   EXPRESSED  AT  ALL  LEVELS  
  • 28. Elaborate the Model Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 28 EVOLUTIONARY  PROCESS  
  • 29. Elaborate the Model Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 29 EXPERIMENTING  IS  ESSENTIAL  
  • 30. Elaborate the Model Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 30 SO  DO  AUTOMATED  TESTING   Test  
  • 31. Ubiquitous Language     Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 31 Technical  aspects  of  design   Technical  terms   Technical  design  paPerns   Business  terms  developers     don’t  understand   Business  terms  everyone     uses  that  don’t  appear     in  design   Domain  model  terms   Names  of  bounded  contexts   Terminology  of  large-­‐scale     structure   DDD  paPern  names   UBIQUITOUS  LANGUAGE   Candidates  to  fold     into  model  
  • 32. Ubiquitous Language Ubiquitous Language     Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 32 Application Code Test Code Specs and documentation Whiteboard discussions Domain Expert Analyst Developer Developer
  • 34. Domain Modelling •  Typical  system  today   –  Consist  of  a  few  subsystems,  responsible  for  mul;ple  func;ons   –  Soaware/Domain  concerns  are  not  clearly  separated       •  Which  func;ons  make  business  successful?   –  Think  about  each  of  them  separately   –  Do  NOT  create  one  model  of  the  whole  domain   –  Otherwise  everything  will  be  connected  to  and  depend  on  everything  else   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 34
  • 35. Domain Modelling – Basic Terms •  Domain     –  Subject  area  where  the  soaware  will  be     applied   –  Example:  VOD  Domain   •  Subdomain   –  Logically  separated  part  of  the  Domain   –  Example:  Inges;on,  Streaming,  Geo  Loca;on   •  Domain  Model   –  Soaware  model  for  solu;on  of  a  domain     problem   •  Bounded  Context   –  Explicit  boundary  where  Domain  Model  lives   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 35 Source:  [Vernon,  DDD]  
  • 36. DomainSubdomain A Subdomain B Subdomain C ProblemSpaceSolutionSpace Bounded Context A Model A Bounded Context B Model B Bounded Context C Model B Problem-Solution Perspective •  Domains  have  problems  space  and  solu;on  space   •  Problem  Space   –  Strategic  business  challenge  to  be  solved   –  Separate  it  into  Subdomains   •  Solu;on  Space   –  Implementa;on  of  the  soaware     to  solve  the  business  problem   –  Bounded  Context  is  a  specific  solu;on   –  The  model  lives  in  the  boundaries  of     Bounded  Context     •  When  you  have  good  understanding  of  the     problem  space,  turn  it  into  solu;on  space   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 36
  • 37. Source:  [Vernon,  DDD]   Subdomains •  Core  Domain   –  part  of  the  business  that  is  of  primary     importance   –  Example:  Asset  Metadata  Delivery   •  Suppor;ng  Domain   –  models  some  aspect  of  the  business     that  is  essen;al,  yet  not  Core   –  Example:  Asset  Streaming  Info   •  Generic  Domain   –  captures  nothing  special  to  the     business,  yet  is  required   –  Example:  GeoLoca;on   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 37 SO  DO  AUTOMATED  TESTING  
  • 38. Bounded Contexts •  Models  are  developed  in  Bounded  Contexts   •  Linguis;c  boundary  in  which  the  model  exists   –  Mark  off  where  the  meaning  of  every  term  used  by  the  domain  model  is  well   understood   –  Example:  User  (Auth  Context:  Role)  and  User  (VOD  Context:  Content  Customer)   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 38 User - role: Admin - subscription: Series Auth Context VOD Context
  • 39. Bounded Contexts •  APempt  to  align  subdomains  one-­‐to-­‐one  with  Bounded  Contexts   •  Could  influence  how  teams  are  organized   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 39 OrganizationLevelContextLevel Context A Context B
  • 40. Context Mapping •  Mapping  the  contact  points  and  transla;ons  between  Bounded  Contexts   •  Context  Mapping  PaPerns   –  Shared  Kernel   •  Shared  Subset  of  Domain   •  Example:  Money   –  Customer/Supplier   •  Upstream  Project  –  Supplier  Team   •  Downstream  Project  –  Consumer   Team   •  Acceptance  test  at  Upstream     context   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 40 Context A Context B Context A Context B Uses agreed interfaces UD
  • 41. Context B Context Mapping •  Context  Mapping  PaPerns   –  Conformist   –  An;-­‐Corrup;on  Layer  (ACL)   •  Isola;ng  Layer   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 41 Context A Context A Context B Conform to existing interfaces UD Adaptor1 Service1 Service2 Facade Adaptor1 Translator2 Translator1 ACL UD
  • 42. Context Mapping •  Context  Mapping  PaPerns   –  Separate  Ways   –  Open  Host  Service  (OHS)   •  a.k.a.  “Remote  Façade”     •  Example:  REST  interface   –  Published  Language  (PL)   •  Example:  XML,  JSON   –  Big  Ball  of  Mud   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 42 Context A Context B
  • 43. Context Mapping •  So,  how  does  it  work?   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 43 Generic Domain Context Subdomain Context Core Domain Context U D OHS / PL ACL U D OHS / PL ACL U D OHS / PL ACL
  • 44. Context Mapping •  So,  how  does  it  work?   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 44 ContextA Context B Adapter Application Service Resource (REST) / OHS HTTP Client (Façade) Translator ACL
  • 45. Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Tactical DDD (DDD-Lite)
  • 46. Source:  [Evans,  DDD]   Layered Architecture                        The  DDD-­‐Lite  is  applied  in  Domain  Layer   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 46
  • 47. Entity •  A.k.a.  “Reference  Object”   •  Has  Iden;ty  and  State   •  May  have  mul;ple  representa;ons   –  Example:  book  through  a  publishing  process   •  Not  defined  primarily  by  their  aPributes   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 47 SO  DO  AUTOMATED  TESTING  
  • 48. Value Object •  Have  no  iden;ty   •  Defined  by  its  aPributes   •  Used  to  describe  the  state  of  En;ty   –  as  its  aPribute   •  Immutable     –  Replacement  rather  than     modifica;on   •  Could  be  implemented  as     Flyweight  [GoF]   •  Example:  Colours,  Money,  Time   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 48 SO  DO  AUTOMATED  TESTING  
  • 49. Services •  Opera;on  which  does  not  conceptually  belongs  to  an  En;ty  or  Value  Object   •  Fine-­‐grained  domain  opera;on  over  domain  objects   –  Usage:  Calcula;on,  transforma;on  etc.   •  Domain  level  –  no  applica;on,  infrastructure  etc.   •  Stateless   •  Usually  Singletons  [GoF]   •  Example:     –  Triggers  En;ty  consistency  valida;on   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 49 SO  DO  AUTOMATED  TESTING  
  • 50. Domain Event •  Event  is  something  that  happened  in  the  domain     •  Purpose:  to  makes  a  change  of  state  explicit   •  Immutable  (it  happened  in  the  past)   •  Data  holding  structure  (POJO)   •  Class  naming  –  command  happened  in  the  past   –  Example:  BrandRenamed   •  Publish-­‐Subscribe  (a.k.a.  Observer  [GoF])   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 50
  • 51. Module •  A.k.a.  packages   •  Divide  code  by  concepts  (not  by  technical  criteria)   •  There  is  limit  to  how  many  things  a  person  can  think  about  at  once  (low  coupling)   •  Choose  Modules  that  tell  the  story  of  the  system   •  Example:   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 51 SO  DO  AUTOMATED  TESTING   [tld].[bounded-context-name].domain.[model | service|…].[conceptname] com.piksel.vod.domain.model com.piksel.auth.domain.model com.piksel.vod.domain.model.assets com.piksel.vod.domain.service com.piksel.vod.resources.view
  • 52. Aggregate •  A  cluster  of  associated  objects  (En;;es  and  Value  Objects  usually)     treated  as  a  unit  for  the  purpose  of  data  changes   •  Root  (En;ty)     •  Boundary  (what  is  inside  the  Aggregate)   •  Enforces  invariants  (business  rules  which  should  be  always  consistent)   •  Only  Aggregate’s  root  could  be  referenced  from  outside  objects   •  Domain  Events  emission   –  On  change  for  the  Aggregate   •  Aggregate  Stores     –  NoSQL  Key-­‐Value/Document  Stores   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 52
  • 53. Factory •  Constructors  -­‐  “primi;ve  level  of  instance  crea;on…  for  the  programming   language”,  Evans   –  use  only  for  very  simple  objects  -­‐  straighlorward  construc;on!   •  Crea;on  of  complex  En;;es/Value  Objects   •  Implementa;on  -­‐  various  crea;onal  (GoF)     paPerns     –  Factory  Method   –  Abstract  Factory     –  Builder   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 53
  • 54. Repository •  A  contract  between  applica;on  and  data  storage,  that  speaks  UL   •  Repository  per  Aggregate   •  Pretends  to  be  a  collec;on  of  Aggregate  Roots   •  Isolates  Domain  Layer  from  persistence  details   •  Uses  Factory  when  storing  new  object   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 54 Source:  [Evans,  DDD]  
  • 55. Repository •  Uses  Factory  when  recons;tutes  preexis;ng  object   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 55 Source:  [Evans,  DDD]  
  • 56. Specification •  Makes  implicit  business  rules  explicit   •  It’s  a  predicate   •  Allows  crea;on  of  Compound  Specifica;ons  (  using  NOT,  AND,  OR,  etc.)   •  Used  for:   –  Valida;on   –  Selec;on  /  Queries  (by  Repository)   –  Building  (Genera;on)   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 56 Source:  [Evans,  DDD]  
  • 57. Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Code / Example
  • 58. Code / Example •  Example  project   –  DDD-­‐CQRS  Sample,  (v.02)   –  HLA:        h'p://prezi.com/akrfq7jyau8w/ddd-­‐cqrs-­‐leaven-­‐v20/   –  Code  base:      h'ps://github.com/Bo'egaIT/ddd-­‐leaven-­‐v2     –  User  Group:    h'ps://groups.google.com/forum/#!forum/ddd-­‐cqrs-­‐sample   •  More  projects  on  official  CQRS  site   –  hPp://cqrs.wordpress.com/examples/   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 58
  • 59. Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Questions?
  • 60. Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 60 Thank  you  for  your  aPen;on!  
  • 62. Resources •  [Evans,  DDD]  "Domain-­‐Driven  Design:  Tackling  Complexity  in  the  Heart  of  Soaware",  Eric   Evans,  Addison  Wesley,  20/08/2003,  ISBN:  0-­‐321-­‐12521-­‐5   •  [Vernon,  DDD],  "Implemen;ng  Domain-­‐Driven  Design",  Vaughn  Vernon,  2013,          ISBN-­‐10:   0-­‐321-­‐83457-­‐7,  ISBN-­‐13:  978-­‐0-­‐321-­‐83457-­‐7   •  [Fowler,  PoEAA]  "PaPerns  of  Enterprise  Applica;on  Architecture",    Mar;n  Fowler,  Dave  Rice,   MaPhew  Foemmel,  Edward  HieaP,  Robert  Mee,  Randy  Stafford),  05/11/2002,  ISBN:   0-­‐321-­‐12742-­‐0   •  [Fowler,  NoSQL]  "NoSQL  Dis;lled",  Mar;n  Fowler,  08/11/2012,  ISBN-­‐10:  0-­‐321-­‐82662-­‐0,   ISBN-­‐13:  978-­‐0-­‐321-­‐82662-­‐6   •  [GoF,  DP]  "Design  PaPerns:  Elements  of  Reusable  Object-­‐Oriented  Soaware",    Erich  Gamma  ,   Richard  Helm  ,  Ralph  Johnson  ,  John  Vlissides,10/11/1994,  ISBN-­‐10:  0201633612,  ISBN-­‐13:   078-­‐5342633610   •  [Fowler,  NoSQL  talk]  "NoSQL  maPers  Cologne  2013  -­‐  Key  Note:  NoSQL  Dis;lled  to  an  hour  -­‐   Mar;n  Fowler",  Mar;n  Fowler,  2013,  h'p://vimeo.com/66052102     Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 62
  • 63. Resources •  [Khan,  DDD]  "Gexng  Started  with  Domain-­‐Driven  Design",  Aslam  Khan,          h'p:// refcardz.dzone.com/refcardz/geLng-­‐started-­‐domain-­‐driven     •  [Brandolini,  DDD  ContextMapping]  "Strategic  Domain  Driven  Design  with  Context  Mapping",   Alberto  Brandolini,  25/11/2009,  h'p://www.infoq.com/arMcles/ddd-­‐contextmapping     •  [Riley,  DDD],  "Domain  Driven  Design",  Ryan  Riley,  22/10/2009,  h'p://www.slideshare.net/ panesofglass/domain-­‐driven-­‐design     •  [Ferguson  ,  DDD],  "Domain  Driven  Design",  John  Ferguson  Smart,  24/08/2011,  h'p:// www.slideshare.net/wakaleo/introducMon-­‐toddd   •  [Sizovs,  DDD]  "Introduc;on  to  DDD",  Eduards  Sizovs,  25/10/2012,  h'p:// www.slideshare.net/eduardsi/introducMon-­‐to-­‐ddd   •  Domain  Driven  Design  Website,  h'p://domaindrivendesign.org/   •  DDD  User  Group,  h'p://tech.groups.yahoo.com/group/domaindrivendesign/   •  DDD  Community,  h'p://dddcommunity.org/   Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 63
  • 64. Bulgarian Java User Group Nikolay Vasilev, CC BY-SA 3.0 Domain Driven Design Page 64