domain driven design - part i
TRANSCRIPT
Domain Driven Design – Part I
Narendran Solai Sridharan
Before we get into the DDD, we shall see 3 Important aspect of Design & Architecture
ScalabilityFlexibility vs Complexity
Distributed Systems
Software Scalability
Z-Axis ScalingFunctional
Decomposition
Y-Axis
Scalin
g
Data Partitioning
X-Axis ScalingHorizontal Duplication Sh
ards, No SQ
L
Partitioning based on
regions or o
ther
categories
Clustering, Replication, Load Balancing, elastic scaling of servers
Set of services(may be a web services, but need not be)In Today’s Context it suit well for Micro services
Functional Decomposition helps to decompose a Domain Service into many smaller services
Catalog Service, Order Service, Shipping Service are some examples of Domain Services
Flexibility vs ComplexityA Tug of war
Flexibility complexity
Solution 1
Solution 2
Non-Goal
It is difficult to achieve both together,Like a double edged sword, mishandling leads to a lot of trouble
What to do ?
Distributed Computing
Object Oriented Programming != Network Programming
CAP Theorem
Complexity vs Enhancement Effort
one class per table in the database
Procedural
We shall see it!!!
Domain Driven Design• REPRESENTING THE MODEL• UBIQUITOUS LANGUAGE• STRATEGIC DESIGN
– Bounded Context– Context Maps
• PATTERNS FOR CONTEXT MAPPING– SHARED KERNEL– CUSTOMER/SUPPLIER DEVELOPMENT TEAMS– CONFORMIST– ANTI-CORRUPTION LAYER– SEPARATE WAYS
• MODELING THE DOMAIN– DEALING WITH STRUCTURE
• ENTITIES• VALUE OBJECTS• CARDINALITY OF ASSOCIATIONS• SERVICES• AGGREGATES• BIG BALL OF MUD
– DEALING WITH LIFE CYCLES• FACTORIES• REPOSITORIES• DOMAIN EVENTS
– DEALING WITH BEHAVIOR• SPECIFICATION PATTERN• STRATEGY PATTERN• COMPOSITE PATTERN
• APPLICATION ARCHITECTURE– LAYERED– EVENT DRIVEN
Domain Driven Design
Context Map
Onion Architecture vs TraditionalOnion Architecture Traditional Architecture
Infrastructure is outsideDomain Model & Interfaces are InsideExternal Layer can access any Internal Layer
Infrastructure is InsideDomain is InsideExternal Layer can access only immediate internal layer
Key tenets of Onion Architecture:The application is built around an independent object modelInner layers define interfaces. Outer layers implement interfacesDirection of coupling is toward the centerAll application core code can be compiled and run separate from infrastructure
Integration of Distributed System
Integration Representation
Many Integration Patterns are available!!!
Core Application in DDD
Micro services
CQRS
Without CQRS With CQRS
Event Sourcing & CQRS