domain driven design - part i

15
Domain Driven Design – Part I Narendran Solai Sridharan

Upload: narendran-solai-sridharan

Post on 12-Apr-2017

149 views

Category:

Engineering


1 download

TRANSCRIPT

Page 1: Domain driven design - Part I

Domain Driven Design – Part I

Narendran Solai Sridharan

Page 2: Domain driven design - Part I

Before we get into the DDD, we shall see 3 Important aspect of Design & Architecture

ScalabilityFlexibility vs Complexity

Distributed Systems

Page 3: Domain driven design - Part I

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

Page 4: Domain driven design - Part I

Catalog Service, Order Service, Shipping Service are some examples of Domain Services

Page 5: Domain driven design - Part I

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 ?

Page 6: Domain driven design - Part I

Distributed Computing

Object Oriented Programming != Network Programming

CAP Theorem

Page 7: Domain driven design - Part I

Complexity vs Enhancement Effort

one class per table in the database

Procedural

We shall see it!!!

Page 8: Domain driven design - Part I

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

Page 9: Domain driven design - Part I

Domain Driven Design

Page 10: Domain driven design - Part I

Context Map

Page 11: Domain driven design - Part I

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

Page 12: Domain driven design - Part I

Integration of Distributed System

Integration Representation

Many Integration Patterns are available!!!

Core Application in DDD

Page 13: Domain driven design - Part I

Micro services

Page 14: Domain driven design - Part I

CQRS

Without CQRS With CQRS

Page 15: Domain driven design - Part I

Event Sourcing & CQRS