SlideShare ist ein Scribd-Unternehmen logo
1 von 41
Downloaden Sie, um offline zu lesen
MODULARITY AND DOMAIN
DRIVEN DESIGN
a killer combination?
Tom De Wolf
Architect
tom.dewolf@aca-it.be
@tomdw
Stijn Van den Enden
CTO
stijn.vandenenden@aca-it.be
@stieno
www.aca-it.be
initial development maintenance phase
Software Design Customer Satisfaction
Separation of Concerns
Low coupling High Cohesion
B AB
A
• Change A impacts all
modules = costly
• Change B requires split
of module = costly
• Change A only impacts
other module if api change
• Change B limited to
module
Encapsulate Source of Change
Predictable Cost of Change
Constant change Business Driven
Aim for 1-on-1 mapping from business changes
onto software constructs
Source of Change = Business
Functional Modularisation
Vehicle
Option
Make
Warranty
Model
Transport
Location
Domain Driven Design
Without modularity
BusinessPartner
Address
Contact
consumer supplier
transports
owner
from to
Vehicle
Option
Make
Warranty
Owner
Model
Transported Item
Transport
Transport Supplier
Transport Consumer
Vehicle Context Transport Context
Domain Driven Design
Modularity with Bounded Contexts BusinessPartner
AddressContact
Business Partner Context
Location
from to
transport
vehicle
MODULAR DATABASE SCHEMA
• cross domain database structures not allowed
• queries cannot cross domain boundaries
NO foreign key
business partner
UUID MAKE MODEL OWNER_ID
djdfjfdkjdk221 Ford C-Max BE1234567
TRANSPORTED_ITEM_ID FROM CONSUMER_ID
djdfjfdkjdk221 454 BE1234567
LOCATION_ID ADDRESS
454 Sunstreet 23
foreign key
VAT_NUMBER NAME
BE1234567 Company A
BENEFITS …
• Domain modules can migrate independently
to next version!
• Database schema is internal to the domain
bundle, i.e. NOT part of the API!
• Persistence and/or database technology can
differ between modules in one system!
Mmodular database migration
cross domain transactions
Tx
Scross domain search and reporting
C
H
A
L
L
E
N
G
E
S
Mmodular database migration
M
Dev Machine 1
MIGRATION CHALLENGE
Dev Machine 2
Continuous
Integration
Test
environment
Acceptance
environment
Production
environment
Version	

1.0.0
Version	

1.0.1
Version	

1.0.2
Version	

?
Version	

?
Version	

?
environment x
Module 1 Module 2 Module 3
Version	

1.0.0
Version	

3.0.0
Version	

2.0.2
Manually track which scripts have run
on which environment for which module ?
M
LIQUIBASE
DATABASECHANGELOG table to track executed changesets for each environment
In versioned source code
XML based DSL for changeSets
www.liquibase.org
M
MODULAR LIQUIBASE
transportvehicle business partner
deployment 1
deployment 2
deployment 3
Migrate modules separately Migrate @deploy of module
migrate to initial version migrate to initial version migrate to initial version
no db changes, no migration migrate to version 2 migrate to version 2
migrate to version 3
M
THE EXTENDER PATTERN
bundle A
bundle B
bundle C
bundle D
extender bundle
Extension Pattern ?!
no match
/OSGI-INF/liquibase/db.changelog-master.xml
osgi-liquibase-extender
framework dependency
Liquibase
change sets domain A
change sets domain B
change sets domain C
• Only extender depends on
Liquibase framework
• Update of single bundle
triggers Liquibase update
• New Liquibase process 

for each matching bundle
Tcross domain transactionsx
JTA OR NOT?
• No persistence layer — direct jdbc/sql access — 1 datasource



• Multiple datasources
• Different types of persistence layers (JPA, NoSQL, …)
• JPA persistence layer in each domain bundle
• instead of one big persistence unit
• even on 1 datasource
T
1 transaction spanning multiple modular domains
JTA not needed
JTA required
x
javax.transaction.TransactionManager
transaction provider
e.g. atomikos
MODULAR PERSISTENCE
T osgi-datasource
XA enabled
vehicle-domaintransport-domain
javax.sql.DataSource
persistence
context
persistence
context
commit
x
Scross domain search
Scross domain search
SEARCH
the tale of the evil joins
NO
cross
module
search
A. Search encapsulated in a separate module leveraging
the functionality of other domain modules
search-
module
domainA
domainB
x
x
Repository
Repository
Stop
• requires specific implementation for every search	

• complexity increases with number of modules	

• inability to leverage power of the datastore
SearchAPI
domainA
B. Search is using a separate query model
search-
module
domainB
SearchAPI
EventProvider
Update	

Events
Update
$ curl -XPUT ‘localhost:9200/vehicle/external/1’ -d ‘{	
	“make”: “BMW”,	
	 “VIN”: “30203232012102”	
}’
index document_type
id
Index a document
$ curl -XPOST ‘localhost:9200/vehicle/external/1/
_update’ -d ‘{	
	“doc”: {“make”: “Alpina”}	
}’
Update a document
index document_type
id
$ curl -XPOST localhost:9200/vehicle/_search?pretty -d
‘{"query":{"match":{"make":"BMW"}}}'	
index
Querying an index
$ curl -XPOST localhost:9200/vehicle/_search?pretty -d
‘{"query":{"match":{"make":"BMW"}}}'	
{	
"took" : 3,	
"timed_out" : false,	
"_shards" : {	
"total" : 5,	
"successful" : 5,	
"failed" : 0	
},	
"hits" : {	
"total" : 2,	
"max_score" : 0.30685282,	
"hits" : [ {	
"_index" : "vehicle",	
"_type" : "external",	
"_id" : "1",	
"_score" : 0.30685282, "_source" : {"make": "BMW", "VIN": "30203232012102"}	
}, {	
"_index" : "vehicle",	
"_type" : "external",	
"_id" : "2",	
"_score" : 0.30685282, "_source" : {"make": "BMW", "VIN": "30203232012112"}	
} ]}}	
!
Querying an index
• Distributed (shards/replicas)	

• Advanced Quering (lucene/geo/
aggregation)	

• Facets (terms/ranges/histogram)	

• API (HTTP/Java/JavaTesting)	

• …
{
1Populate the index
1Populate the index
package be.vabfs.search.api;	
!
public interface SearchIndexService {	
	 	
	 void update(Object entityToUpdate);	
	 	
	 void delete(Object entityToRemove);	
!
	 void populate();	
!
	 void clear();	
!
}
search
SearchIndexService
domainB
Entity
EntityListener
@PrePersist
@PostUpdate
@PostRemove
1Populate the index
search
SearchIndexService
update(entity)
Synchronise onTransaction
Track updated entities
A
Map entities to searchData
B
Bulk update search index
C
1Populate the index
Map entities to searchData
B
package be.vabfs.search.api.data;	
!
import java.util.List;	
!
public interface SearchDataProvider {	
!
	 Class<? extends Object> getEntityClass();	
	 	
	 List<SearchData> index(Object entity);	
!
}
domainB
Entity
SearchData
1Populate the index
Map entities to searchData
B
SearchDataProvider
domainB
Entity
SearchData
1Populate the index
A
search
SearchIndexService
update(entity)
Synchronise onTransaction
Track updated entities
Bulk update search index
C
Map entities to searchData
B SearchDataProvider
domainB
A
2Enhancing Search
2Enhancing Search
2Enhancing Search
search
SearchService
package be.vabfs.search.api;	
!
import …	
!
public interface SearchService {	
	
…	
!
SearchResults query(String query, int start, int rows,	
	 	 	 	 	 	 	 	String sort, String sortOrder,	
	 	 	 	 	 	 	 	 	 String documentType);	
	 	
	 List<String> options(String field, 	
	 	 	 	 	 	 	 	 	 	 String... documentTypes);	
	 	
	 List<SearchCriterion> availableCriteria(	
	 	 	 	 	 	 	 	 	 	 String... criteriaCategories);	
	 	
}
2Enhancing Search
package be.vabfs.search.api.criteria;	
!
import java.util.List;	
!
public interface SearchCriteriaProvider {	
	 	
	 String getProviderCategory();	
	 	
	 List<SearchCriterion> getAvailableCriteria();	
}	
package be.vabfs.search.api.criteria;	
!
public interface SearchCriterion {	
!
	 String getName();	
	 String getKey();	
	 String getUnitName();	
	 SearchCriterionType getType();	
	 SearchCriterionQueryType getQueryType();	
	 String getDocumentType();	
!
}
"vehicle.mileage"
"mileage"
SearchCriterionType.NUMBER
SearchCriterionQueryType.RANGE_NUMBER
"SERVICE_ITEM"
"km"
2Enhancing Search
search
SearchService
domainB
SearchCriteriaProvider
domainB
LESSONS LEARNED
@deployment time migration = RISK
• have CI build continuously migrate current production
data
Refactor wrong modularisation requires unwanted migration
dependencies
• reset/flatten migration change sets to restore
modularisation
Migration
Cross domain search and reporting
Effort to integrate search is limited
• due to dynamic osgi service model
Advanced search functionality is possible
WHAT IS NEXT?
Multiple module versions active? Multiple schema versions
active?
• e.g. feature try-out to limited customer base
Downgrade to older module version?
• Previous schema with new data?
Hot deploy while users are firing requests?
• Migration still busy = failure
Migration
Cross domain search and reporting
Domain Specific Query Language
!
Exploiting elastic search capabilities beyond search, e.g.
reporting
M
Modular migration
Liquibase extender @ DeployT
Cross domain transactions
Distributed JTA transactionsx S
Cross domain search
Elasticsearch view
Functionally	

not limited by domain module boundaries to answer business questions
Non-functionally
future-proof platform with impact of change contained in loosely coupled domain modules
Tom De Wolf
Architect
tom.dewolf@aca-it.be
@tomdw
Stijn Van den Enden
CTO
stijn.vandenenden@aca-it.be
@stieno
www.aca-it.be

Weitere ähnliche Inhalte

Was ist angesagt?

Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...
Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...
Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...
NLJUG
 
DITA Quick Start for Authors Part II
DITA Quick Start for Authors Part IIDITA Quick Start for Authors Part II
DITA Quick Start for Authors Part II
Suite Solutions
 

Was ist angesagt? (20)

Domain Driven Design(DDD) Presentation
Domain Driven Design(DDD) PresentationDomain Driven Design(DDD) Presentation
Domain Driven Design(DDD) Presentation
 
Introduction to-ddd
Introduction to-dddIntroduction to-ddd
Introduction to-ddd
 
Tactical DDD (just better OOP?) - PHPBenelux 2017
Tactical DDD (just better OOP?) - PHPBenelux 2017Tactical DDD (just better OOP?) - PHPBenelux 2017
Tactical DDD (just better OOP?) - PHPBenelux 2017
 
Introduction to DDD
Introduction to DDDIntroduction to DDD
Introduction to DDD
 
Applying Domain-Driven Design to craft Rich Domain Models
Applying Domain-Driven Design to craft Rich Domain ModelsApplying Domain-Driven Design to craft Rich Domain Models
Applying Domain-Driven Design to craft Rich Domain Models
 
Domain Driven Design Demonstrated
Domain Driven Design Demonstrated Domain Driven Design Demonstrated
Domain Driven Design Demonstrated
 
Domain-Driven Design
Domain-Driven DesignDomain-Driven Design
Domain-Driven Design
 
شرح Domain Driven Design بالعربي
شرح Domain Driven Design بالعربيشرح Domain Driven Design بالعربي
شرح Domain Driven Design بالعربي
 
Domain Driven Design Development Spring Portfolio
Domain Driven Design Development Spring PortfolioDomain Driven Design Development Spring Portfolio
Domain Driven Design Development Spring Portfolio
 
Amazon AWS - a quick review
Amazon AWS - a quick reviewAmazon AWS - a quick review
Amazon AWS - a quick review
 
Domain driven design: a gentle introduction
Domain driven design:  a gentle introductionDomain driven design:  a gentle introduction
Domain driven design: a gentle introduction
 
Domain Driven Design: Zero to Hero
Domain Driven Design: Zero to HeroDomain Driven Design: Zero to Hero
Domain Driven Design: Zero to Hero
 
Domain Event - The Hidden Gem of DDD
Domain Event - The Hidden Gem of DDDDomain Event - The Hidden Gem of DDD
Domain Event - The Hidden Gem of DDD
 
Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...
Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...
Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & St...
 
DDD and Microservices: Like Peanut Butter and Jelly - Matt Stine
DDD and Microservices: Like Peanut Butter and Jelly - Matt StineDDD and Microservices: Like Peanut Butter and Jelly - Matt Stine
DDD and Microservices: Like Peanut Butter and Jelly - Matt Stine
 
Domain Driven Design 101
Domain Driven Design 101Domain Driven Design 101
Domain Driven Design 101
 
DITA Quick Start for Authors Part II
DITA Quick Start for Authors Part IIDITA Quick Start for Authors Part II
DITA Quick Start for Authors Part II
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
If your computer is cloud what its Operating System look like?
If your computer is cloud what its Operating System look like?If your computer is cloud what its Operating System look like?
If your computer is cloud what its Operating System look like?
 
Crafted Design - Sandro Mancuso
Crafted Design - Sandro MancusoCrafted Design - Sandro Mancuso
Crafted Design - Sandro Mancuso
 

Andere mochten auch

Mapping Problem Domain Objects to Object-Persistence Formats(OOAD)
Mapping Problem Domain Objects to Object-Persistence Formats(OOAD)Mapping Problem Domain Objects to Object-Persistence Formats(OOAD)
Mapping Problem Domain Objects to Object-Persistence Formats(OOAD)
Meenakshi Devi
 
Domain driven design in a nutshell
Domain driven design in a nutshellDomain driven design in a nutshell
Domain driven design in a nutshell
Toni Esteves
 
Why Domain-Driven Design Matters
Why Domain-Driven Design MattersWhy Domain-Driven Design Matters
Why Domain-Driven Design Matters
Mathias Verraes
 

Andere mochten auch (20)

Refactoring domain driven design way
Refactoring domain driven design wayRefactoring domain driven design way
Refactoring domain driven design way
 
jTransfo lightning talk
jTransfo lightning talkjTransfo lightning talk
jTransfo lightning talk
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Mapping Problem Domain Objects to Object-Persistence Formats(OOAD)
Mapping Problem Domain Objects to Object-Persistence Formats(OOAD)Mapping Problem Domain Objects to Object-Persistence Formats(OOAD)
Mapping Problem Domain Objects to Object-Persistence Formats(OOAD)
 
Applying Object Composition to Build Rich Domain Models
Applying Object Composition to Build Rich Domain ModelsApplying Object Composition to Build Rich Domain Models
Applying Object Composition to Build Rich Domain Models
 
ZendCon 2011 UnCon Domain-Driven Design
ZendCon 2011 UnCon Domain-Driven DesignZendCon 2011 UnCon Domain-Driven Design
ZendCon 2011 UnCon Domain-Driven Design
 
Domain driven design in a nutshell
Domain driven design in a nutshellDomain driven design in a nutshell
Domain driven design in a nutshell
 
Success by Challenging Assumptions (Part I)
Success by Challenging Assumptions (Part I)Success by Challenging Assumptions (Part I)
Success by Challenging Assumptions (Part I)
 
Domain Driven Design Quickly
Domain Driven Design QuicklyDomain Driven Design Quickly
Domain Driven Design Quickly
 
Introduction to Domain Driven Design
Introduction to Domain Driven DesignIntroduction to Domain Driven Design
Introduction to Domain Driven Design
 
Context Mapping In Action
Context Mapping In ActionContext Mapping In Action
Context Mapping In Action
 
Domain State model OOAD
Domain State model  OOADDomain State model  OOAD
Domain State model OOAD
 
Domain Driven Design and Hexagonal Architecture with Rails
Domain Driven Design and Hexagonal Architecture with RailsDomain Driven Design and Hexagonal Architecture with Rails
Domain Driven Design and Hexagonal Architecture with Rails
 
Refactoring for Domain Driven Design
Refactoring for Domain Driven DesignRefactoring for Domain Driven Design
Refactoring for Domain Driven Design
 
Domain object model
Domain object modelDomain object model
Domain object model
 
Why Domain-Driven Design Matters
Why Domain-Driven Design MattersWhy Domain-Driven Design Matters
Why Domain-Driven Design Matters
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introduction
 
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
 
Implementing DDD with C#
Implementing DDD with C#Implementing DDD with C#
Implementing DDD with C#
 
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
 

Ähnlich wie Modularity and Domain Driven Design; a killer combination?

Entity Framework: Code First and Magic Unicorns
Entity Framework: Code First and Magic UnicornsEntity Framework: Code First and Magic Unicorns
Entity Framework: Code First and Magic Unicorns
Richie Rump
 
Migrating Very Large Site Collections (SPSDC)
Migrating Very Large Site Collections (SPSDC)Migrating Very Large Site Collections (SPSDC)
Migrating Very Large Site Collections (SPSDC)
kiwiboris
 

Ähnlich wie Modularity and Domain Driven Design; a killer combination? (20)

Spring data presentation
Spring data presentationSpring data presentation
Spring data presentation
 
AWS Webcast - Build high-scale applications with Amazon DynamoDB
AWS Webcast - Build high-scale applications with Amazon DynamoDBAWS Webcast - Build high-scale applications with Amazon DynamoDB
AWS Webcast - Build high-scale applications with Amazon DynamoDB
 
Enterprise guide to building a Data Mesh
Enterprise guide to building a Data MeshEnterprise guide to building a Data Mesh
Enterprise guide to building a Data Mesh
 
Apache Calcite: A Foundational Framework for Optimized Query Processing Over ...
Apache Calcite: A Foundational Framework for Optimized Query Processing Over ...Apache Calcite: A Foundational Framework for Optimized Query Processing Over ...
Apache Calcite: A Foundational Framework for Optimized Query Processing Over ...
 
FiloDB: Reactive, Real-Time, In-Memory Time Series at Scale
FiloDB: Reactive, Real-Time, In-Memory Time Series at ScaleFiloDB: Reactive, Real-Time, In-Memory Time Series at Scale
FiloDB: Reactive, Real-Time, In-Memory Time Series at Scale
 
What's New in .Net 4.5
What's New in .Net 4.5What's New in .Net 4.5
What's New in .Net 4.5
 
The Evolution of a Relational Database Layer over HBase
The Evolution of a Relational Database Layer over HBaseThe Evolution of a Relational Database Layer over HBase
The Evolution of a Relational Database Layer over HBase
 
Metaworks4 intro
Metaworks4 introMetaworks4 intro
Metaworks4 intro
 
Tackle Containerization Advisor (TCA) for Legacy Applications
Tackle Containerization Advisor (TCA) for Legacy ApplicationsTackle Containerization Advisor (TCA) for Legacy Applications
Tackle Containerization Advisor (TCA) for Legacy Applications
 
dotNet Miami - June 21, 2012: Richie Rump: Entity Framework: Code First and M...
dotNet Miami - June 21, 2012: Richie Rump: Entity Framework: Code First and M...dotNet Miami - June 21, 2012: Richie Rump: Entity Framework: Code First and M...
dotNet Miami - June 21, 2012: Richie Rump: Entity Framework: Code First and M...
 
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...
 
Deploying your Data Warehouse on AWS
Deploying your Data Warehouse on AWSDeploying your Data Warehouse on AWS
Deploying your Data Warehouse on AWS
 
Entity Framework: Code First and Magic Unicorns
Entity Framework: Code First and Magic UnicornsEntity Framework: Code First and Magic Unicorns
Entity Framework: Code First and Magic Unicorns
 
Migrating Very Large Site Collections (SPSDC)
Migrating Very Large Site Collections (SPSDC)Migrating Very Large Site Collections (SPSDC)
Migrating Very Large Site Collections (SPSDC)
 
Developing real-time data pipelines with Spring and Kafka
Developing real-time data pipelines with Spring and KafkaDeveloping real-time data pipelines with Spring and Kafka
Developing real-time data pipelines with Spring and Kafka
 
Access Data from XPages with the Relational Controls
Access Data from XPages with the Relational ControlsAccess Data from XPages with the Relational Controls
Access Data from XPages with the Relational Controls
 
How to Migrate from Cassandra to Amazon DynamoDB - AWS Online Tech Talks
How to Migrate from Cassandra to Amazon DynamoDB - AWS Online Tech TalksHow to Migrate from Cassandra to Amazon DynamoDB - AWS Online Tech Talks
How to Migrate from Cassandra to Amazon DynamoDB - AWS Online Tech Talks
 
Software Development: Beyond Training wheels
Software Development: Beyond Training wheelsSoftware Development: Beyond Training wheels
Software Development: Beyond Training wheels
 
What is WebDAV - uploaded by Murali Krishna Nookella
What is WebDAV - uploaded by Murali Krishna NookellaWhat is WebDAV - uploaded by Murali Krishna Nookella
What is WebDAV - uploaded by Murali Krishna Nookella
 
Ladies Be Architects - Integration - Multi-Org, Security, JSON, Backup & Restore
Ladies Be Architects - Integration - Multi-Org, Security, JSON, Backup & RestoreLadies Be Architects - Integration - Multi-Org, Security, JSON, Backup & Restore
Ladies Be Architects - Integration - Multi-Org, Security, JSON, Backup & Restore
 

Mehr von ACA IT-Solutions

Mehr von ACA IT-Solutions (20)

The steps of enterprise innovation at ACA IT-Solutions
The steps of enterprise innovation at ACA IT-SolutionsThe steps of enterprise innovation at ACA IT-Solutions
The steps of enterprise innovation at ACA IT-Solutions
 
The right tool / technology for the right job : by Yakup Kalin (ACA IT-Soluti...
The right tool / technology for the right job : by Yakup Kalin (ACA IT-Soluti...The right tool / technology for the right job : by Yakup Kalin (ACA IT-Soluti...
The right tool / technology for the right job : by Yakup Kalin (ACA IT-Soluti...
 
IT MATCH: Vastgoedfinanciering voor zelfstandigen / freelancers in België
IT MATCH: Vastgoedfinanciering voor zelfstandigen / freelancers in BelgiëIT MATCH: Vastgoedfinanciering voor zelfstandigen / freelancers in België
IT MATCH: Vastgoedfinanciering voor zelfstandigen / freelancers in België
 
ACA-Mobile - Creating Enterprise Apps with MADP
ACA-Mobile - Creating Enterprise Apps with MADPACA-Mobile - Creating Enterprise Apps with MADP
ACA-Mobile - Creating Enterprise Apps with MADP
 
JavaOne 2016 - 10 Key Lessons you should know
JavaOne 2016 - 10 Key Lessons you should knowJavaOne 2016 - 10 Key Lessons you should know
JavaOne 2016 - 10 Key Lessons you should know
 
Axway Introduction & Digital Business (by Jo Van Audenhove & Rogier van Boxtel)
Axway Introduction & Digital Business (by Jo Van Audenhove & Rogier van Boxtel)Axway Introduction & Digital Business (by Jo Van Audenhove & Rogier van Boxtel)
Axway Introduction & Digital Business (by Jo Van Audenhove & Rogier van Boxtel)
 
How to transform your business with Appcelerator (Stijn Wijndaele)
How to transform your business with Appcelerator (Stijn Wijndaele)How to transform your business with Appcelerator (Stijn Wijndaele)
How to transform your business with Appcelerator (Stijn Wijndaele)
 
ACA IT-Solutions introduction 2016 (Willy Van Mechelen)
ACA IT-Solutions introduction 2016 (Willy Van Mechelen)ACA IT-Solutions introduction 2016 (Willy Van Mechelen)
ACA IT-Solutions introduction 2016 (Willy Van Mechelen)
 
Appcelerator: Customer testimonial and demo (VAB Fleet Services - Diederik De...
Appcelerator: Customer testimonial and demo (VAB Fleet Services - Diederik De...Appcelerator: Customer testimonial and demo (VAB Fleet Services - Diederik De...
Appcelerator: Customer testimonial and demo (VAB Fleet Services - Diederik De...
 
IT MATCH: Aansprakelijkheidsverzekering voor IT'ers
IT MATCH: Aansprakelijkheidsverzekering voor IT'ersIT MATCH: Aansprakelijkheidsverzekering voor IT'ers
IT MATCH: Aansprakelijkheidsverzekering voor IT'ers
 
IT MATCH: contracten onderhandelen als zelfstandige / freelancer
IT MATCH: contracten onderhandelen als zelfstandige / freelancerIT MATCH: contracten onderhandelen als zelfstandige / freelancer
IT MATCH: contracten onderhandelen als zelfstandige / freelancer
 
IT MATCH: Pensioen voor zelfstandigen (België)
IT MATCH: Pensioen voor zelfstandigen (België)IT MATCH: Pensioen voor zelfstandigen (België)
IT MATCH: Pensioen voor zelfstandigen (België)
 
Revolutionize your IT Team with JIRA Service Desk
Revolutionize your IT Team with JIRA Service Desk Revolutionize your IT Team with JIRA Service Desk
Revolutionize your IT Team with JIRA Service Desk
 
Going Beyond JIRA Service Desk: Use Cases in Action
Going Beyond JIRA Service Desk: Use Cases in ActionGoing Beyond JIRA Service Desk: Use Cases in Action
Going Beyond JIRA Service Desk: Use Cases in Action
 
'DOCKER' & CLOUD: ENABLERS For DEVOPS
'DOCKER' & CLOUD:  ENABLERS For DEVOPS'DOCKER' & CLOUD:  ENABLERS For DEVOPS
'DOCKER' & CLOUD: ENABLERS For DEVOPS
 
What’s hot in the world of atlassian
What’s hot in the world of atlassianWhat’s hot in the world of atlassian
What’s hot in the world of atlassian
 
JavaOne 2015: 14 Key Lessons, you should learn
JavaOne 2015: 14 Key Lessons, you should learnJavaOne 2015: 14 Key Lessons, you should learn
JavaOne 2015: 14 Key Lessons, you should learn
 
JIRA Portfolio: Failing to plan is your best plan for failure
JIRA Portfolio: Failing to plan is your best plan for failureJIRA Portfolio: Failing to plan is your best plan for failure
JIRA Portfolio: Failing to plan is your best plan for failure
 
A practical guide on what UX could mean to your business (Peter Gevaerts - AC...
A practical guide on what UX could mean to your business (Peter Gevaerts - AC...A practical guide on what UX could mean to your business (Peter Gevaerts - AC...
A practical guide on what UX could mean to your business (Peter Gevaerts - AC...
 
What is IoT and how can it impact your business - by Piet Vandaele
What is IoT and how can it impact your business - by Piet VandaeleWhat is IoT and how can it impact your business - by Piet Vandaele
What is IoT and how can it impact your business - by Piet Vandaele
 

Kürzlich hochgeladen

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Kürzlich hochgeladen (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

Modularity and Domain Driven Design; a killer combination?

  • 1. MODULARITY AND DOMAIN DRIVEN DESIGN a killer combination? Tom De Wolf Architect tom.dewolf@aca-it.be @tomdw Stijn Van den Enden CTO stijn.vandenenden@aca-it.be @stieno www.aca-it.be
  • 2. initial development maintenance phase Software Design Customer Satisfaction Separation of Concerns Low coupling High Cohesion B AB A • Change A impacts all modules = costly • Change B requires split of module = costly • Change A only impacts other module if api change • Change B limited to module Encapsulate Source of Change Predictable Cost of Change Constant change Business Driven Aim for 1-on-1 mapping from business changes onto software constructs Source of Change = Business Functional Modularisation
  • 3. Vehicle Option Make Warranty Model Transport Location Domain Driven Design Without modularity BusinessPartner Address Contact consumer supplier transports owner from to
  • 4. Vehicle Option Make Warranty Owner Model Transported Item Transport Transport Supplier Transport Consumer Vehicle Context Transport Context Domain Driven Design Modularity with Bounded Contexts BusinessPartner AddressContact Business Partner Context Location from to
  • 5. transport vehicle MODULAR DATABASE SCHEMA • cross domain database structures not allowed • queries cannot cross domain boundaries NO foreign key business partner UUID MAKE MODEL OWNER_ID djdfjfdkjdk221 Ford C-Max BE1234567 TRANSPORTED_ITEM_ID FROM CONSUMER_ID djdfjfdkjdk221 454 BE1234567 LOCATION_ID ADDRESS 454 Sunstreet 23 foreign key VAT_NUMBER NAME BE1234567 Company A
  • 6. BENEFITS … • Domain modules can migrate independently to next version! • Database schema is internal to the domain bundle, i.e. NOT part of the API! • Persistence and/or database technology can differ between modules in one system!
  • 7. Mmodular database migration cross domain transactions Tx Scross domain search and reporting C H A L L E N G E S
  • 9. M Dev Machine 1 MIGRATION CHALLENGE Dev Machine 2 Continuous Integration Test environment Acceptance environment Production environment Version 1.0.0 Version 1.0.1 Version 1.0.2 Version ? Version ? Version ? environment x Module 1 Module 2 Module 3 Version 1.0.0 Version 3.0.0 Version 2.0.2 Manually track which scripts have run on which environment for which module ?
  • 10. M LIQUIBASE DATABASECHANGELOG table to track executed changesets for each environment In versioned source code XML based DSL for changeSets www.liquibase.org
  • 11. M MODULAR LIQUIBASE transportvehicle business partner deployment 1 deployment 2 deployment 3 Migrate modules separately Migrate @deploy of module migrate to initial version migrate to initial version migrate to initial version no db changes, no migration migrate to version 2 migrate to version 2 migrate to version 3
  • 12. M THE EXTENDER PATTERN bundle A bundle B bundle C bundle D extender bundle Extension Pattern ?! no match /OSGI-INF/liquibase/db.changelog-master.xml osgi-liquibase-extender framework dependency Liquibase change sets domain A change sets domain B change sets domain C • Only extender depends on Liquibase framework • Update of single bundle triggers Liquibase update • New Liquibase process 
 for each matching bundle
  • 14. JTA OR NOT? • No persistence layer — direct jdbc/sql access — 1 datasource
 
 • Multiple datasources • Different types of persistence layers (JPA, NoSQL, …) • JPA persistence layer in each domain bundle • instead of one big persistence unit • even on 1 datasource T 1 transaction spanning multiple modular domains JTA not needed JTA required x
  • 15. javax.transaction.TransactionManager transaction provider e.g. atomikos MODULAR PERSISTENCE T osgi-datasource XA enabled vehicle-domaintransport-domain javax.sql.DataSource persistence context persistence context commit x
  • 17. Scross domain search SEARCH the tale of the evil joins
  • 19. A. Search encapsulated in a separate module leveraging the functionality of other domain modules search- module domainA domainB x x Repository Repository Stop • requires specific implementation for every search • complexity increases with number of modules • inability to leverage power of the datastore SearchAPI
  • 20. domainA B. Search is using a separate query model search- module domainB SearchAPI EventProvider Update Events Update
  • 21.
  • 22. $ curl -XPUT ‘localhost:9200/vehicle/external/1’ -d ‘{ “make”: “BMW”, “VIN”: “30203232012102” }’ index document_type id Index a document
  • 23. $ curl -XPOST ‘localhost:9200/vehicle/external/1/ _update’ -d ‘{ “doc”: {“make”: “Alpina”} }’ Update a document index document_type id
  • 24. $ curl -XPOST localhost:9200/vehicle/_search?pretty -d ‘{"query":{"match":{"make":"BMW"}}}' index Querying an index
  • 25. $ curl -XPOST localhost:9200/vehicle/_search?pretty -d ‘{"query":{"match":{"make":"BMW"}}}' { "took" : 3, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 2, "max_score" : 0.30685282, "hits" : [ { "_index" : "vehicle", "_type" : "external", "_id" : "1", "_score" : 0.30685282, "_source" : {"make": "BMW", "VIN": "30203232012102"} }, { "_index" : "vehicle", "_type" : "external", "_id" : "2", "_score" : 0.30685282, "_source" : {"make": "BMW", "VIN": "30203232012112"} } ]}} ! Querying an index
  • 26. • Distributed (shards/replicas) • Advanced Quering (lucene/geo/ aggregation) • Facets (terms/ranges/histogram) • API (HTTP/Java/JavaTesting) • … {
  • 28. 1Populate the index package be.vabfs.search.api; ! public interface SearchIndexService { void update(Object entityToUpdate); void delete(Object entityToRemove); ! void populate(); ! void clear(); ! } search SearchIndexService domainB Entity EntityListener @PrePersist @PostUpdate @PostRemove
  • 29. 1Populate the index search SearchIndexService update(entity) Synchronise onTransaction Track updated entities A Map entities to searchData B Bulk update search index C
  • 30. 1Populate the index Map entities to searchData B package be.vabfs.search.api.data; ! import java.util.List; ! public interface SearchDataProvider { ! Class<? extends Object> getEntityClass(); List<SearchData> index(Object entity); ! } domainB Entity SearchData
  • 31. 1Populate the index Map entities to searchData B SearchDataProvider domainB Entity SearchData
  • 32. 1Populate the index A search SearchIndexService update(entity) Synchronise onTransaction Track updated entities Bulk update search index C Map entities to searchData B SearchDataProvider domainB A
  • 35. 2Enhancing Search search SearchService package be.vabfs.search.api; ! import … ! public interface SearchService { … ! SearchResults query(String query, int start, int rows, String sort, String sortOrder, String documentType); List<String> options(String field, String... documentTypes); List<SearchCriterion> availableCriteria( String... criteriaCategories); }
  • 36. 2Enhancing Search package be.vabfs.search.api.criteria; ! import java.util.List; ! public interface SearchCriteriaProvider { String getProviderCategory(); List<SearchCriterion> getAvailableCriteria(); } package be.vabfs.search.api.criteria; ! public interface SearchCriterion { ! String getName(); String getKey(); String getUnitName(); SearchCriterionType getType(); SearchCriterionQueryType getQueryType(); String getDocumentType(); ! } "vehicle.mileage" "mileage" SearchCriterionType.NUMBER SearchCriterionQueryType.RANGE_NUMBER "SERVICE_ITEM" "km"
  • 38. LESSONS LEARNED @deployment time migration = RISK • have CI build continuously migrate current production data Refactor wrong modularisation requires unwanted migration dependencies • reset/flatten migration change sets to restore modularisation Migration Cross domain search and reporting Effort to integrate search is limited • due to dynamic osgi service model Advanced search functionality is possible
  • 39. WHAT IS NEXT? Multiple module versions active? Multiple schema versions active? • e.g. feature try-out to limited customer base Downgrade to older module version? • Previous schema with new data? Hot deploy while users are firing requests? • Migration still busy = failure Migration Cross domain search and reporting Domain Specific Query Language ! Exploiting elastic search capabilities beyond search, e.g. reporting
  • 40. M Modular migration Liquibase extender @ DeployT Cross domain transactions Distributed JTA transactionsx S Cross domain search Elasticsearch view Functionally not limited by domain module boundaries to answer business questions Non-functionally future-proof platform with impact of change contained in loosely coupled domain modules
  • 41. Tom De Wolf Architect tom.dewolf@aca-it.be @tomdw Stijn Van den Enden CTO stijn.vandenenden@aca-it.be @stieno www.aca-it.be