SlideShare a Scribd company logo
IMPLEMENTATION
DOMAIN-DRIVEN DESIGN CH04
ARCHITECTURE
Presenter : HarryYao
Date : 2019/05/08
Recap
■ Strategic Modeling
– Architecture
■ Tactical Modeling
Example – Insurance Company
■ Customer Management
– 客戶資料管理,客戶個資
■ Customer Self-Service Management
– 客戶自助服務,線上個資維護,線上投保,保單查詢,理賠進度查詢…
■ Policy Management
– 保險契約管理,新契約客戶初審計算費率(Risk Management)
■ Debt Collection
– 保費繳收與依契約理賠出險
■ Risk Management
– 風險管理,提供新契約風險評估報告
■ Printing Context
– 提供API供訪問,可列印債務、保險契約、客戶資料或報表
Round 1. 每人一張白報紙
架構規劃 10min
Scenario
客戶在線上網上投保旅遊平安險.
保險專員印出保單讓主管進行簽核完成投保.
SaaSOvation CIO Recap
Core is always DDD.
■ Client-Server
■ Layered
■ DIP ( UI, Infrastructure)
■ REST
■ SOA
■ CQRS
■ Pipe and Filter (Message Queue , Event Streaming)
■ Event Sourcing
About 2002~2006
User Interface
Application Service
Domain Service, Domain Model
Infrastructure
LayeredArchitecture
User Interface
UI/UX, Presentation
Application Service
Cooperate with each layer
ex. Data-in from User Interface,
Create/Update Data to infrastructure
Domain Service, Domain Model
Business Logic , Entity
Infrastructure
Repository , Database, File , Service
LayeredArchitecture + DIP
High-level
Low-level
Interface(API)
Interface(SPI)
Decoupling FromTechnology
MockTesting
Application Isolate
Domain Isolate
Supplement : Dependency Inversion
Principle (DIP)
Buy Gift
Gift
禮物 Layer
交往 Layer
Buy Gift
Gift
<<I>>
Buy Gift
男友需要了解
禮物,才能買
男友不須了解
禮物,有錢可以
買就好=>
有錢任性
Supplement : API & SPI
Application Programming Interface(API)
■ theAPI is the description of classes/interfaces/methods/... that you call and use to achieve a goal
Service Provider Interface(SPI)
■ the SPI is the description of classes/interfaces/methods/... that you extend and implement to achieve
a goal
differently,
■ theAPI tells you what a specific class/method does for you and
■ the SPI tells you what you must do to conform.
Supplement : Services/Systems in
Layered
API
Application
Layer
Domain
Layer
SPI
Infrastructure
Layer
API Application
Layer
Domain
Layer
SPI
Infrastructure
Layer
API
Application
Layer
Domain
Layer
SPI
Infrastructure
Layer
API Application
Layer
Domain
Layer
SPI
Infrastructure
Layer
UI
UI
UI
SystemA
Service C
System B
System D
API Application
Layer
Domain
Layer
SPI
Infrastructure
Layer
Service E
Supplement : ESB (Enterprise Service Bus)
 A Product
 well implement for SOA
 Layered-Style
 API & SPI Integration
 For Services or Resources Request
In Layered Follow SOA Principles
HexagonalArchitecture (2005~)
User Interface
UI/UX, Presentation
Application Service
Cooperate with each layer
ex. Data-in from User Interface,
Create/Update Data to infrastructure
Domain Service, Domain Model
Business Logic , Entity
Infrastructure
Repository , Database, File , Service
SOAP, REST, Message… in Hexagonal
Follow SOA Principles Port & Adapter
SOAP , REST… in Layered
REST
API
SOAP
API
SOAP(Simple ObjectAccess Protocol)
■ Expose & Encapsulate Service
REST(Representational StateTransfer)
• Expose & Encapsulate Resource
• Stateless communication
• Idempotent ( GET,PUT,DELETE)
• Richardson Maturity Model(Martin
fowler)
Supplement : HexagonalArchitecture
Reference
Supplement : Hexagonal
Architecture(cont’), DIP
Primary/Driving
API
Adapter Pattern
Secondary/Driven
SPI
Bridge/Strategy/Command… Pattern
Supplement : HexagonalArchitecture
CRUD
■ Model for Update & Query
■ Performance: Resource Lock ,Transaction
Lock
■ Security : Access Control, data masking…
private int i = 0;
private int Increase(int value)
{
i += value;
return i;
}
CQS( Command-Query Separation)
■ Command : no return , but change state.
■ Query : return data, no change state.
■ Log shipping , ETL for Reporting DB
private int i = 0;
private void Increase(int value)
{
i += value;
}
private int GetValue()
{
return i;
}
CQRS ( Command-Queries
Responsibility Segregation)■ Query Processor : basic SQL
■ Query Model : only data for display (View)
■ Command Processor: get instance of
aggregates from repository and publish
events ,let Event Subscriber update Query
Model(idempotent)
■ Eventually ConsistentQuery Model
Query Login
Success Count
Login Success
Login Success
Event
Increase Login
Success Count
Login Success
Event
Event-Driven Architecture
Sample : cat
■ cat phone_numbers.txt | grep 303 | wc –l
■ 3
■ Services/Systems in Hexagonal
Filters
PhoneNumberFinder
MatchedPhoneNumberCounterPhoneNumbersPublisher
<<event>>
AllPhoneNumbersListed
<<event>>
PhoneNumbersMatched
<<event>>
MatchedPhoneNumbersCounted
PhoneNumberExecutive
Saga (Long running
time process)
■ ProcessManager
■ Transaction-like
■ Concurrency process
■ Commit or Rollback
3 of 15 phone numbers matched on July 15, 2012 at 11:27
PM
15 phone numbers 3 phone numbers matched
Design a Long Running Process (Saga)
Method1
■ Executive create aTracker to record
■ passively time-check when event is
handling or
■ active time-check by timer.
Design a Long Running Process(Cont’)
Aggregate ( Executive &Tracker )
begin
done
1
2
3
3
Method2
Method3
CQRS + Event Sourcing
■ ChangeTracking objects and the value
produced in our system
■ Patch the event store with new or
modified events that fix problem
■ Undo and redo changes
■ “what if” questions , simulate past or
virtual scenario .
CQRS + Event Souring in Layered Style
Domain Layer
Infrastructure Layer
User Interface Layer
Application Layer
Application Layer
Data Fabric and Grid-Based Distributed
Computing high-performance computing system
consisting of loosely coupled storage,
networking and parallel processing functions linked
by high bandwidth interconnects…
Kafka (2011~)
• Data(Partition) Replication ,
Leader down <- Follower raise
• Guaranteed Delivery
• Eventual Consistency
• Continues Queries (Subscribe), Streaming
Conclusion
■ SRP=> Separation of Concern
■ OCP=>open to add adapter , port
■ LSP=>When Implement API , SPI , follow base contract
■ ISP=>Expose & Encapsulate Service or Resource
■ DIP=> Inverse of Control, Decoupling
■ REST(Resource),SOAP(Service),Message(Event), CQRS(Event)…
in Layered/Hexagonal…
follow SOA… principles
■ Modern Infrastructure Support
Example – Insurance Company
■ Customer Management
– 客戶資料管理,客戶個資
■ Customer Self-Service Management
– 客戶自助服務,線上個資維護,線上投保,保單查詢,理賠進度查詢…
■ Policy Management
– 保險契約管理,新契約客戶初審計算費率(Risk Management)
■ Debt Collection
– 保費繳收與依契約理賠出險
■ Risk Management
– 風險管理,提供新契約風險評估報告
■ Printing Context
– 提供API供訪問,可列印債務、保險契約、客戶資料或報表
Round 2. 每組一張白報紙
架構規劃 15min
各組分享 3~5min
Scenario
客戶在線上網上投保旅遊平安險.
保險專員印出保單讓主管進行簽核完成投保.

More Related Content

Similar to Implementation domain driven design - ch04 architecture

Kafka summit SF 2019 - the art of the event-streaming app
Kafka summit SF 2019 - the art of the event-streaming appKafka summit SF 2019 - the art of the event-streaming app
Kafka summit SF 2019 - the art of the event-streaming app
Neil Avery
 
The art of the event streaming application: streams, stream processors and sc...
The art of the event streaming application: streams, stream processors and sc...The art of the event streaming application: streams, stream processors and sc...
The art of the event streaming application: streams, stream processors and sc...
confluent
 
Changing Views on Integration (AUSOUG Webinar Series, May 2020)
Changing Views on Integration (AUSOUG Webinar Series, May 2020)Changing Views on Integration (AUSOUG Webinar Series, May 2020)
Changing Views on Integration (AUSOUG Webinar Series, May 2020)
Lucas Jellema
 
성공적인 서비스로의 플랫폼 선택
성공적인 서비스로의 플랫폼 선택성공적인 서비스로의 플랫폼 선택
성공적인 서비스로의 플랫폼 선택
uEngine Solutions
 
CQRS and Event Sourcing
CQRS and Event Sourcing CQRS and Event Sourcing
CQRS and Event Sourcing
Inho Kang
 
[Hands-on] CQRS(Command Query Responsibility Segregation) 와 Event Sourcing 패턴 실습
[Hands-on] CQRS(Command Query Responsibility Segregation) 와 Event Sourcing 패턴 실습[Hands-on] CQRS(Command Query Responsibility Segregation) 와 Event Sourcing 패턴 실습
[Hands-on] CQRS(Command Query Responsibility Segregation) 와 Event Sourcing 패턴 실습
Oracle Korea
 
5 Years Of Building SaaS On AWS
5 Years Of Building SaaS On AWS5 Years Of Building SaaS On AWS
5 Years Of Building SaaS On AWS
Christian Beedgen
 
Intuit Financial Data Platform Microservices Journey
Intuit Financial Data Platform Microservices JourneyIntuit Financial Data Platform Microservices Journey
Intuit Financial Data Platform Microservices Journey
Madhu Chetuparambil
 
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
confluent
 
Kakfa summit london 2019 - the art of the event-streaming app
Kakfa summit london 2019 - the art of the event-streaming appKakfa summit london 2019 - the art of the event-streaming app
Kakfa summit london 2019 - the art of the event-streaming app
Neil Avery
 
Awesome Banking API's
Awesome Banking API'sAwesome Banking API's
Awesome Banking API's
Natalino Busa
 
Building a Real-Time Security Application Using Log Data and Machine Learning...
Building a Real-Time Security Application Using Log Data and Machine Learning...Building a Real-Time Security Application Using Log Data and Machine Learning...
Building a Real-Time Security Application Using Log Data and Machine Learning...
Sri Ambati
 
Testing Event Driven Architectures: How to Broker the Complexity | Frank Kilc...
Testing Event Driven Architectures: How to Broker the Complexity | Frank Kilc...Testing Event Driven Architectures: How to Broker the Complexity | Frank Kilc...
Testing Event Driven Architectures: How to Broker the Complexity | Frank Kilc...
HostedbyConfluent
 
PayPal datalake journey | teradata - edge of next | san diego | 2017 october ...
PayPal datalake journey | teradata - edge of next | san diego | 2017 october ...PayPal datalake journey | teradata - edge of next | san diego | 2017 october ...
PayPal datalake journey | teradata - edge of next | san diego | 2017 october ...
Deepak Chandramouli
 
Continuous Intelligence - Intersecting Event-Based Business Logic and ML
Continuous Intelligence - Intersecting Event-Based Business Logic and MLContinuous Intelligence - Intersecting Event-Based Business Logic and ML
Continuous Intelligence - Intersecting Event-Based Business Logic and ML
Paris Carbone
 
Sukumar Nayak-Agile-DevOps-Cloud Management
Sukumar Nayak-Agile-DevOps-Cloud ManagementSukumar Nayak-Agile-DevOps-Cloud Management
Sukumar Nayak-Agile-DevOps-Cloud ManagementSukumar Nayak
 
Regulated Reactive - Security Considerations for Building Reactive Systems in...
Regulated Reactive - Security Considerations for Building Reactive Systems in...Regulated Reactive - Security Considerations for Building Reactive Systems in...
Regulated Reactive - Security Considerations for Building Reactive Systems in...
Ryan Hodgin
 
Security Challenges in Cloud Integration - Cloud Security Alliance, Austin Ch...
Security Challenges in Cloud Integration - Cloud Security Alliance, Austin Ch...Security Challenges in Cloud Integration - Cloud Security Alliance, Austin Ch...
Security Challenges in Cloud Integration - Cloud Security Alliance, Austin Ch...
Glen Roberts, CISSP
 
Elastic Integration for ServiceNow
Elastic Integration for ServiceNowElastic Integration for ServiceNow
Elastic Integration for ServiceNow
SnapLogic
 
On the Application of AI for Failure Management: Problems, Solutions and Algo...
On the Application of AI for Failure Management: Problems, Solutions and Algo...On the Application of AI for Failure Management: Problems, Solutions and Algo...
On the Application of AI for Failure Management: Problems, Solutions and Algo...
Jorge Cardoso
 

Similar to Implementation domain driven design - ch04 architecture (20)

Kafka summit SF 2019 - the art of the event-streaming app
Kafka summit SF 2019 - the art of the event-streaming appKafka summit SF 2019 - the art of the event-streaming app
Kafka summit SF 2019 - the art of the event-streaming app
 
The art of the event streaming application: streams, stream processors and sc...
The art of the event streaming application: streams, stream processors and sc...The art of the event streaming application: streams, stream processors and sc...
The art of the event streaming application: streams, stream processors and sc...
 
Changing Views on Integration (AUSOUG Webinar Series, May 2020)
Changing Views on Integration (AUSOUG Webinar Series, May 2020)Changing Views on Integration (AUSOUG Webinar Series, May 2020)
Changing Views on Integration (AUSOUG Webinar Series, May 2020)
 
성공적인 서비스로의 플랫폼 선택
성공적인 서비스로의 플랫폼 선택성공적인 서비스로의 플랫폼 선택
성공적인 서비스로의 플랫폼 선택
 
CQRS and Event Sourcing
CQRS and Event Sourcing CQRS and Event Sourcing
CQRS and Event Sourcing
 
[Hands-on] CQRS(Command Query Responsibility Segregation) 와 Event Sourcing 패턴 실습
[Hands-on] CQRS(Command Query Responsibility Segregation) 와 Event Sourcing 패턴 실습[Hands-on] CQRS(Command Query Responsibility Segregation) 와 Event Sourcing 패턴 실습
[Hands-on] CQRS(Command Query Responsibility Segregation) 와 Event Sourcing 패턴 실습
 
5 Years Of Building SaaS On AWS
5 Years Of Building SaaS On AWS5 Years Of Building SaaS On AWS
5 Years Of Building SaaS On AWS
 
Intuit Financial Data Platform Microservices Journey
Intuit Financial Data Platform Microservices JourneyIntuit Financial Data Platform Microservices Journey
Intuit Financial Data Platform Microservices Journey
 
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
 
Kakfa summit london 2019 - the art of the event-streaming app
Kakfa summit london 2019 - the art of the event-streaming appKakfa summit london 2019 - the art of the event-streaming app
Kakfa summit london 2019 - the art of the event-streaming app
 
Awesome Banking API's
Awesome Banking API'sAwesome Banking API's
Awesome Banking API's
 
Building a Real-Time Security Application Using Log Data and Machine Learning...
Building a Real-Time Security Application Using Log Data and Machine Learning...Building a Real-Time Security Application Using Log Data and Machine Learning...
Building a Real-Time Security Application Using Log Data and Machine Learning...
 
Testing Event Driven Architectures: How to Broker the Complexity | Frank Kilc...
Testing Event Driven Architectures: How to Broker the Complexity | Frank Kilc...Testing Event Driven Architectures: How to Broker the Complexity | Frank Kilc...
Testing Event Driven Architectures: How to Broker the Complexity | Frank Kilc...
 
PayPal datalake journey | teradata - edge of next | san diego | 2017 october ...
PayPal datalake journey | teradata - edge of next | san diego | 2017 october ...PayPal datalake journey | teradata - edge of next | san diego | 2017 october ...
PayPal datalake journey | teradata - edge of next | san diego | 2017 october ...
 
Continuous Intelligence - Intersecting Event-Based Business Logic and ML
Continuous Intelligence - Intersecting Event-Based Business Logic and MLContinuous Intelligence - Intersecting Event-Based Business Logic and ML
Continuous Intelligence - Intersecting Event-Based Business Logic and ML
 
Sukumar Nayak-Agile-DevOps-Cloud Management
Sukumar Nayak-Agile-DevOps-Cloud ManagementSukumar Nayak-Agile-DevOps-Cloud Management
Sukumar Nayak-Agile-DevOps-Cloud Management
 
Regulated Reactive - Security Considerations for Building Reactive Systems in...
Regulated Reactive - Security Considerations for Building Reactive Systems in...Regulated Reactive - Security Considerations for Building Reactive Systems in...
Regulated Reactive - Security Considerations for Building Reactive Systems in...
 
Security Challenges in Cloud Integration - Cloud Security Alliance, Austin Ch...
Security Challenges in Cloud Integration - Cloud Security Alliance, Austin Ch...Security Challenges in Cloud Integration - Cloud Security Alliance, Austin Ch...
Security Challenges in Cloud Integration - Cloud Security Alliance, Austin Ch...
 
Elastic Integration for ServiceNow
Elastic Integration for ServiceNowElastic Integration for ServiceNow
Elastic Integration for ServiceNow
 
On the Application of AI for Failure Management: Problems, Solutions and Algo...
On the Application of AI for Failure Management: Problems, Solutions and Algo...On the Application of AI for Failure Management: Problems, Solutions and Algo...
On the Application of AI for Failure Management: Problems, Solutions and Algo...
 

Recently uploaded

Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
abdulrafaychaudhry
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
abdulrafaychaudhry
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 

Recently uploaded (20)

Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 

Implementation domain driven design - ch04 architecture

  • 2. Recap ■ Strategic Modeling – Architecture ■ Tactical Modeling
  • 3. Example – Insurance Company ■ Customer Management – 客戶資料管理,客戶個資 ■ Customer Self-Service Management – 客戶自助服務,線上個資維護,線上投保,保單查詢,理賠進度查詢… ■ Policy Management – 保險契約管理,新契約客戶初審計算費率(Risk Management) ■ Debt Collection – 保費繳收與依契約理賠出險 ■ Risk Management – 風險管理,提供新契約風險評估報告 ■ Printing Context – 提供API供訪問,可列印債務、保險契約、客戶資料或報表 Round 1. 每人一張白報紙 架構規劃 10min Scenario 客戶在線上網上投保旅遊平安險. 保險專員印出保單讓主管進行簽核完成投保.
  • 4. SaaSOvation CIO Recap Core is always DDD. ■ Client-Server ■ Layered ■ DIP ( UI, Infrastructure) ■ REST ■ SOA ■ CQRS ■ Pipe and Filter (Message Queue , Event Streaming) ■ Event Sourcing
  • 5. About 2002~2006 User Interface Application Service Domain Service, Domain Model Infrastructure
  • 6. LayeredArchitecture User Interface UI/UX, Presentation Application Service Cooperate with each layer ex. Data-in from User Interface, Create/Update Data to infrastructure Domain Service, Domain Model Business Logic , Entity Infrastructure Repository , Database, File , Service
  • 7. LayeredArchitecture + DIP High-level Low-level Interface(API) Interface(SPI) Decoupling FromTechnology MockTesting Application Isolate Domain Isolate
  • 8. Supplement : Dependency Inversion Principle (DIP) Buy Gift Gift 禮物 Layer 交往 Layer Buy Gift Gift <<I>> Buy Gift 男友需要了解 禮物,才能買 男友不須了解 禮物,有錢可以 買就好=> 有錢任性
  • 9. Supplement : API & SPI Application Programming Interface(API) ■ theAPI is the description of classes/interfaces/methods/... that you call and use to achieve a goal Service Provider Interface(SPI) ■ the SPI is the description of classes/interfaces/methods/... that you extend and implement to achieve a goal differently, ■ theAPI tells you what a specific class/method does for you and ■ the SPI tells you what you must do to conform.
  • 10. Supplement : Services/Systems in Layered API Application Layer Domain Layer SPI Infrastructure Layer API Application Layer Domain Layer SPI Infrastructure Layer API Application Layer Domain Layer SPI Infrastructure Layer API Application Layer Domain Layer SPI Infrastructure Layer UI UI UI SystemA Service C System B System D API Application Layer Domain Layer SPI Infrastructure Layer Service E
  • 11. Supplement : ESB (Enterprise Service Bus)  A Product  well implement for SOA  Layered-Style  API & SPI Integration  For Services or Resources Request In Layered Follow SOA Principles
  • 12. HexagonalArchitecture (2005~) User Interface UI/UX, Presentation Application Service Cooperate with each layer ex. Data-in from User Interface, Create/Update Data to infrastructure Domain Service, Domain Model Business Logic , Entity Infrastructure Repository , Database, File , Service
  • 13. SOAP, REST, Message… in Hexagonal Follow SOA Principles Port & Adapter
  • 14. SOAP , REST… in Layered REST API SOAP API
  • 15. SOAP(Simple ObjectAccess Protocol) ■ Expose & Encapsulate Service REST(Representational StateTransfer) • Expose & Encapsulate Resource • Stateless communication • Idempotent ( GET,PUT,DELETE) • Richardson Maturity Model(Martin fowler)
  • 17. Supplement : Hexagonal Architecture(cont’), DIP Primary/Driving API Adapter Pattern Secondary/Driven SPI Bridge/Strategy/Command… Pattern
  • 19. CRUD ■ Model for Update & Query ■ Performance: Resource Lock ,Transaction Lock ■ Security : Access Control, data masking… private int i = 0; private int Increase(int value) { i += value; return i; }
  • 20. CQS( Command-Query Separation) ■ Command : no return , but change state. ■ Query : return data, no change state. ■ Log shipping , ETL for Reporting DB private int i = 0; private void Increase(int value) { i += value; } private int GetValue() { return i; }
  • 21. CQRS ( Command-Queries Responsibility Segregation)■ Query Processor : basic SQL ■ Query Model : only data for display (View) ■ Command Processor: get instance of aggregates from repository and publish events ,let Event Subscriber update Query Model(idempotent) ■ Eventually ConsistentQuery Model Query Login Success Count Login Success Login Success Event Increase Login Success Count Login Success Event
  • 23. Sample : cat ■ cat phone_numbers.txt | grep 303 | wc –l ■ 3 ■ Services/Systems in Hexagonal Filters PhoneNumberFinder MatchedPhoneNumberCounterPhoneNumbersPublisher <<event>> AllPhoneNumbersListed <<event>> PhoneNumbersMatched <<event>> MatchedPhoneNumbersCounted PhoneNumberExecutive
  • 24. Saga (Long running time process) ■ ProcessManager ■ Transaction-like ■ Concurrency process ■ Commit or Rollback 3 of 15 phone numbers matched on July 15, 2012 at 11:27 PM 15 phone numbers 3 phone numbers matched
  • 25. Design a Long Running Process (Saga) Method1 ■ Executive create aTracker to record ■ passively time-check when event is handling or ■ active time-check by timer.
  • 26. Design a Long Running Process(Cont’) Aggregate ( Executive &Tracker ) begin done 1 2 3 3 Method2 Method3
  • 27. CQRS + Event Sourcing ■ ChangeTracking objects and the value produced in our system ■ Patch the event store with new or modified events that fix problem ■ Undo and redo changes ■ “what if” questions , simulate past or virtual scenario .
  • 28. CQRS + Event Souring in Layered Style Domain Layer Infrastructure Layer User Interface Layer Application Layer Application Layer
  • 29. Data Fabric and Grid-Based Distributed Computing high-performance computing system consisting of loosely coupled storage, networking and parallel processing functions linked by high bandwidth interconnects…
  • 30. Kafka (2011~) • Data(Partition) Replication , Leader down <- Follower raise • Guaranteed Delivery • Eventual Consistency • Continues Queries (Subscribe), Streaming
  • 31. Conclusion ■ SRP=> Separation of Concern ■ OCP=>open to add adapter , port ■ LSP=>When Implement API , SPI , follow base contract ■ ISP=>Expose & Encapsulate Service or Resource ■ DIP=> Inverse of Control, Decoupling ■ REST(Resource),SOAP(Service),Message(Event), CQRS(Event)… in Layered/Hexagonal… follow SOA… principles ■ Modern Infrastructure Support
  • 32. Example – Insurance Company ■ Customer Management – 客戶資料管理,客戶個資 ■ Customer Self-Service Management – 客戶自助服務,線上個資維護,線上投保,保單查詢,理賠進度查詢… ■ Policy Management – 保險契約管理,新契約客戶初審計算費率(Risk Management) ■ Debt Collection – 保費繳收與依契約理賠出險 ■ Risk Management – 風險管理,提供新契約風險評估報告 ■ Printing Context – 提供API供訪問,可列印債務、保險契約、客戶資料或報表 Round 2. 每組一張白報紙 架構規劃 15min 各組分享 3~5min Scenario 客戶在線上網上投保旅遊平安險. 保險專員印出保單讓主管進行簽核完成投保.