SlideShare uma empresa Scribd logo
1 de 41
Baixar para ler offline
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
Software Design Customer Satisfaction 
Separation of Concerns 
initial development maintenance phase 
Low coupling High Cohesion 
B B A 
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 
owner 
transports 
from to
Business Partner Context 
Domain Driven Design 
Modularity with Bounded Contexts Contact BusinessPartner Address 
Vehicle 
Option 
Make 
Warranty 
Owner 
Model 
Transported Item 
Transport Supplier 
Transport 
Transport Consumer 
from to 
Location 
Vehicle Context Transport Context
MODULAR DATABASE SCHEMA 
transport 
NO foreign key 
vehicle 
TRANSPORTED_ITEM_ID FROM CONSUMER_ID 
djdfjfdkjdk221 454 BE1234567 
foreign key 
LOCATION_ID ADDRESS 
454 Sunstreet 23 
business partner 
UUID MAKE MODEL OWNER_ID 
djdfjfdkjdk221 Ford C-Max BE1234567 
VAT_NUMBER NAME 
BE1234567 Company A 
• cross domain database structures not allowed 
• queries cannot cross domain boundaries
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 TxS 
cross domain search and reporting 
CHALLENGES
Mmodular database migration
MIGRATION CHALLENGE 
MDev Machine 1 
Dev Machine 2 
Continuous 
Integration 
Test 
environment 
Acceptance 
environment 
Version 
1.0.0 
Production 
environment 
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 
In versioned source code 
XML based DSL for changeSets 
www.liquibase.org 
DATABASECHANGELOG table to track executed changesets for each environment
MMODULAR LIQUIBASE 
vehicle transport business partner 
deployment 1 
deployment 2 
deployment 3 
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 
Migrate modules separately Migrate @deploy of module
MTHE 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 transactions x
JTA OR NOT? 
T1 transaction spanning multiple modular domains 
JTA not needed 
• even on 1 datasource • No persistence layer — direct jdbc/sql access — 1 datasource 
JTA required 
x 
• Multiple datasources 
• Different types of persistence layers (JPA, NoSQL, …) 
• JPA persistence layer in each domain bundle 
• instead of one big persistence unit
T MODULAR PERSISTENCE transport-domain vehicle-domain 
osgi-datasource 
XA enabled 
javax.transaction.TransactionManager 
transaction provider 
e.g. atomikos 
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 
SearchAPI 
• requires specific implementation for every search 
• complexity increases with number of modules 
• inability to leverage power of the datastore
Update 
Events 
SearchAPI EventProvider 
domainA 
B. Search is using a separate query model 
search-module 
domainB 
Update
index document_type 
$ curl -XPUT ‘localhost:9200/vehicle/external/1’ -d ‘{ 
“make”: “BMW”, 
“VIN”: “30203232012102” 
id 
}’ 
Index a document
Update a document 
index document_type 
$ curl -XPOST ‘localhost:9200/vehicle/external/1/ 
_update’ -d ‘{ 
“doc”: {“make”: “Alpina”} 
id 
}’
index 
Querying an index 
$ curl -XPOST localhost:9200/vehicle/_search?pretty -d 
‘{"query":{"match":{"make":"BMW"}}}'
Querying an index 
$ curl -XPOST localhost:9200/vehicle/_search?pretty -d 
‘{"query":{"match":{"mark":"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" : {"makes": "BMW", "VIN": "30203232012112"} 
} ]}}
• Distributed (shards/replicas) 
• Advanced Quering (lucene/geo/ 
aggregation) 
• Facets (terms/ranges/histogram) 
• API (HTTP/Java/Java Testing) 
• … {
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 
update(entity) 
SearchIndexService 
Track updated entities A 
Map entities to searchData B 
Bulk update search index C 
Synchronise on Transaction
1B 
Map entities to searchData Populate the index 
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
1B 
Map entities to searchData SearchDataProvider 
Populate the index 
domainB 
Entity 
SearchData
1A 
Populate the index 
search 
update(entity) 
SearchIndexService 
Track updated entities 
Map entities to searchData B SearchDataProvider 
Bulk update search index C 
Synchronise on Transaction 
domainB
2Enhancing Search
2Enhancing Search
2search 
SearchService 
Enhancing Search 
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" 
"km" 
SearchCriterionType.NUMBER 
SearchCriterionQueryType.RANGE_NUMBER 
"SERVICE_ITEM"
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? 
Migration 
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 
Cross domain search and reporting 
Domain Specific Query Language 
Exploiting elastic search capabilities beyond search, e.g. 
reporting
MModular migration 
Liquibase extender @ DeployTCross domain transactions 
SCross domain search 
x Distributed JTA transactionsElasticsearch 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

Mais conteúdo relacionado

Mais procurados

Synchronize AD and OpenLDAP with LSC
Synchronize AD and OpenLDAP with LSCSynchronize AD and OpenLDAP with LSC
Synchronize AD and OpenLDAP with LSC
LDAPCon
 

Mais procurados (20)

Changing landscapes in data integration - Kafka Connect for near real-time da...
Changing landscapes in data integration - Kafka Connect for near real-time da...Changing landscapes in data integration - Kafka Connect for near real-time da...
Changing landscapes in data integration - Kafka Connect for near real-time da...
 
Developing a custom Kafka connector? Make it shine! | Igor Buzatović, Porsche...
Developing a custom Kafka connector? Make it shine! | Igor Buzatović, Porsche...Developing a custom Kafka connector? Make it shine! | Igor Buzatović, Porsche...
Developing a custom Kafka connector? Make it shine! | Igor Buzatović, Porsche...
 
Solutions for bi-directional integration between Oracle RDBMS and Apache Kafka
Solutions for bi-directional integration between Oracle RDBMS and Apache KafkaSolutions for bi-directional integration between Oracle RDBMS and Apache Kafka
Solutions for bi-directional integration between Oracle RDBMS and Apache Kafka
 
Synchronize AD and OpenLDAP with LSC
Synchronize AD and OpenLDAP with LSCSynchronize AD and OpenLDAP with LSC
Synchronize AD and OpenLDAP with LSC
 
How web works and browser works ? (behind the scenes)
How web works and browser works ? (behind the scenes)How web works and browser works ? (behind the scenes)
How web works and browser works ? (behind the scenes)
 
OpenSouthCode 2018 - Integrating your applications easily with Apache Camel
OpenSouthCode 2018 - Integrating your applications easily with Apache CamelOpenSouthCode 2018 - Integrating your applications easily with Apache Camel
OpenSouthCode 2018 - Integrating your applications easily with Apache Camel
 
orioncontextbroker-ngsiv2-overview-for-developers-that-already-know-ngsiv1-20...
orioncontextbroker-ngsiv2-overview-for-developers-that-already-know-ngsiv1-20...orioncontextbroker-ngsiv2-overview-for-developers-that-already-know-ngsiv1-20...
orioncontextbroker-ngsiv2-overview-for-developers-that-already-know-ngsiv1-20...
 
Solutions for bi-directional Integration between Oracle RDMBS & Apache Kafka
Solutions for bi-directional Integration between Oracle RDMBS & Apache KafkaSolutions for bi-directional Integration between Oracle RDMBS & Apache Kafka
Solutions for bi-directional Integration between Oracle RDMBS & Apache Kafka
 
Lagom - Mircoservices "Just Right"
Lagom - Mircoservices "Just Right"Lagom - Mircoservices "Just Right"
Lagom - Mircoservices "Just Right"
 
LINQ in C#
LINQ in C#LINQ in C#
LINQ in C#
 
Event sourcing - what could possibly go wrong ? Devoxx PL 2021
Event sourcing  - what could possibly go wrong ? Devoxx PL 2021Event sourcing  - what could possibly go wrong ? Devoxx PL 2021
Event sourcing - what could possibly go wrong ? Devoxx PL 2021
 
NGRX Apps in Depth
NGRX Apps in DepthNGRX Apps in Depth
NGRX Apps in Depth
 
Managing "Big Data" Application Complexity with CloudGraph
Managing "Big Data" Application Complexity with CloudGraphManaging "Big Data" Application Complexity with CloudGraph
Managing "Big Data" Application Complexity with CloudGraph
 
Exploring KSQL Patterns
Exploring KSQL Patterns Exploring KSQL Patterns
Exploring KSQL Patterns
 
Hypermedia System Architecture for a Web of Things
Hypermedia System Architecture for a Web of ThingsHypermedia System Architecture for a Web of Things
Hypermedia System Architecture for a Web of Things
 
Failing to Cross the Streams – Lessons Learned the Hard Way | Philip Schmitt,...
Failing to Cross the Streams – Lessons Learned the Hard Way | Philip Schmitt,...Failing to Cross the Streams – Lessons Learned the Hard Way | Philip Schmitt,...
Failing to Cross the Streams – Lessons Learned the Hard Way | Philip Schmitt,...
 
Mind the App: How to Monitor Your Kafka Streams Applications | Bruno Cadonna,...
Mind the App: How to Monitor Your Kafka Streams Applications | Bruno Cadonna,...Mind the App: How to Monitor Your Kafka Streams Applications | Bruno Cadonna,...
Mind the App: How to Monitor Your Kafka Streams Applications | Bruno Cadonna,...
 
Understanding linq
Understanding linqUnderstanding linq
Understanding linq
 
From Zero to Hero with Kafka Connect
From Zero to Hero with Kafka ConnectFrom Zero to Hero with Kafka Connect
From Zero to Hero with Kafka Connect
 
How to build an ETL pipeline with Apache Beam on Google Cloud Dataflow
How to build an ETL pipeline with Apache Beam on Google Cloud DataflowHow to build an ETL pipeline with Apache Beam on Google Cloud Dataflow
How to build an ETL pipeline with Apache Beam on Google Cloud Dataflow
 

Destaque

Destaque (11)

Beyond breaking bad. The current state of agile in ten easy lessons
Beyond breaking bad. The current state of agile in ten easy lessonsBeyond breaking bad. The current state of agile in ten easy lessons
Beyond breaking bad. The current state of agile in ten easy lessons
 
Geecon Prague 2016 - Thirty months of microservices
Geecon Prague 2016 - Thirty months of microservicesGeecon Prague 2016 - Thirty months of microservices
Geecon Prague 2016 - Thirty months of microservices
 
Economic Frameworks
Economic FrameworksEconomic Frameworks
Economic Frameworks
 
Introduction
IntroductionIntroduction
Introduction
 
Thirty months of microservices. Stairway to heaven or highway to hell
Thirty months of microservices. Stairway to heaven or highway to hellThirty months of microservices. Stairway to heaven or highway to hell
Thirty months of microservices. Stairway to heaven or highway to hell
 
Building Better Software Faster
Building Better Software FasterBuilding Better Software Faster
Building Better Software Faster
 
Breaking the Monolith
Breaking the MonolithBreaking the Monolith
Breaking the Monolith
 
Growing a microservices landscape (with smart use cases)
Growing a microservices landscape (with smart use cases)Growing a microservices landscape (with smart use cases)
Growing a microservices landscape (with smart use cases)
 
Why Scaling Agile Doesn't Work (and What to Do About It)
Why Scaling Agile Doesn't Work (and What to Do About It)Why Scaling Agile Doesn't Work (and What to Do About It)
Why Scaling Agile Doesn't Work (and What to Do About It)
 
Devops Scorecard
Devops ScorecardDevops Scorecard
Devops Scorecard
 
Continuous Delivery Sounds Great but it Won't Work Here
Continuous Delivery Sounds Great but it Won't Work HereContinuous Delivery Sounds Great but it Won't Work Here
Continuous Delivery Sounds Great but it Won't Work Here
 

Semelhante a Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & Stijn van den Enden

Semelhante a Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & Stijn van den Enden (20)

Modularity and Domain Driven Design; a killer combination?
Modularity and Domain Driven Design; a killer combination?Modularity and Domain Driven Design; a killer combination?
Modularity and Domain Driven Design; a killer combination?
 
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
 
MongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDBMongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDB
 
Decomposing the Monolith using modern-day .NET and a touch of microservices
Decomposing the Monolith using modern-day .NET and a touch of microservicesDecomposing the Monolith using modern-day .NET and a touch of microservices
Decomposing the Monolith using modern-day .NET and a touch of microservices
 
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
 
Debugging Microservices - QCON 2017
Debugging Microservices - QCON 2017Debugging Microservices - QCON 2017
Debugging Microservices - QCON 2017
 
Microservice Automated Testing on Kubernetes
Microservice Automated Testing on KubernetesMicroservice Automated Testing on Kubernetes
Microservice Automated Testing on Kubernetes
 
Incremental Queries and Transformations for Engineering Critical Systems
Incremental Queries and Transformations for Engineering Critical SystemsIncremental Queries and Transformations for Engineering Critical Systems
Incremental Queries and Transformations for Engineering Critical Systems
 
GIB2021 - Dan Probert - BizTalk Migrator Deep Dive
GIB2021 - Dan Probert - BizTalk Migrator Deep DiveGIB2021 - Dan Probert - BizTalk Migrator Deep Dive
GIB2021 - Dan Probert - BizTalk Migrator Deep Dive
 
Developing scalable enterprise serverless applications on azure with .net
Developing scalable enterprise serverless applications on azure with .netDeveloping scalable enterprise serverless applications on azure with .net
Developing scalable enterprise serverless applications on azure with .net
 
SeedStack feature tour
SeedStack feature tourSeedStack feature tour
SeedStack feature tour
 
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
 
Oracle to Azure PostgreSQL database migration webinar
Oracle to Azure PostgreSQL database migration webinarOracle to Azure PostgreSQL database migration webinar
Oracle to Azure PostgreSQL database migration webinar
 
Novedades de MongoDB 3.6
Novedades de MongoDB 3.6Novedades de MongoDB 3.6
Novedades de MongoDB 3.6
 
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
 
Crafted Design - Sandro Mancuso
Crafted Design - Sandro MancusoCrafted Design - Sandro Mancuso
Crafted Design - Sandro Mancuso
 
Modern android development
Modern android developmentModern android development
Modern android development
 
Migrating on premises workload to azure sql database
Migrating on premises workload to azure sql databaseMigrating on premises workload to azure sql database
Migrating on premises workload to azure sql database
 
OroCRM Partner Technical Training: September 2015
OroCRM Partner Technical Training: September 2015OroCRM Partner Technical Training: September 2015
OroCRM Partner Technical Training: September 2015
 
Productionalizing ML : Real Experience
Productionalizing ML : Real ExperienceProductionalizing ML : Real Experience
Productionalizing ML : Real Experience
 

Mais de NLJUG

Mais de NLJUG (20)

The future of Web-Scale - Johan Tillema, Rene Boere & Chris Quach
The future of Web-Scale - Johan Tillema, Rene Boere & Chris QuachThe future of Web-Scale - Johan Tillema, Rene Boere & Chris Quach
The future of Web-Scale - Johan Tillema, Rene Boere & Chris Quach
 
Speedy perception trumps speedy reception–smart asynchronous interactions - L...
Speedy perception trumps speedy reception–smart asynchronous interactions - L...Speedy perception trumps speedy reception–smart asynchronous interactions - L...
Speedy perception trumps speedy reception–smart asynchronous interactions - L...
 
Decoding the airspace above you with Java and $7 hardware - Bert Jan Schrijver
Decoding the airspace above you with Java and $7 hardware - Bert Jan SchrijverDecoding the airspace above you with Java and $7 hardware - Bert Jan Schrijver
Decoding the airspace above you with Java and $7 hardware - Bert Jan Schrijver
 
Using Docker to Develop, Test and Run Maven Projects - Wouter Danes
Using Docker to Develop, Test and Run Maven Projects - Wouter DanesUsing Docker to Develop, Test and Run Maven Projects - Wouter Danes
Using Docker to Develop, Test and Run Maven Projects - Wouter Danes
 
Kill the mutants and test your tests - Roy van Rijn
Kill the mutants and test your tests - Roy van RijnKill the mutants and test your tests - Roy van Rijn
Kill the mutants and test your tests - Roy van Rijn
 
Real-time user interfaces - sosm gewoon makkelijker - Allard Buijze
Real-time user interfaces - sosm gewoon makkelijker - Allard BuijzeReal-time user interfaces - sosm gewoon makkelijker - Allard Buijze
Real-time user interfaces - sosm gewoon makkelijker - Allard Buijze
 
The end of traditional enterprise IT - ING's journey to the next generation I...
The end of traditional enterprise IT - ING's journey to the next generation I...The end of traditional enterprise IT - ING's journey to the next generation I...
The end of traditional enterprise IT - ING's journey to the next generation I...
 
Performance van Java 8 en verder - Jeroen Borgers
Performance van Java 8 en verder - Jeroen BorgersPerformance van Java 8 en verder - Jeroen Borgers
Performance van Java 8 en verder - Jeroen Borgers
 
Introduction to Reactive with Play and Akka - Markus Jura
Introduction to Reactive with Play and Akka - Markus JuraIntroduction to Reactive with Play and Akka - Markus Jura
Introduction to Reactive with Play and Akka - Markus Jura
 
Web-scale op basis van Hadoop en Akka Reactive Streams - Johan Tillema, Rene ...
Web-scale op basis van Hadoop en Akka Reactive Streams - Johan Tillema, Rene ...Web-scale op basis van Hadoop en Akka Reactive Streams - Johan Tillema, Rene ...
Web-scale op basis van Hadoop en Akka Reactive Streams - Johan Tillema, Rene ...
 
Workshop angular dart presentatie - Atos
Workshop angular dart presentatie - AtosWorkshop angular dart presentatie - Atos
Workshop angular dart presentatie - Atos
 
Workshop spring boot presentatie - Atos
Workshop spring boot presentatie - AtosWorkshop spring boot presentatie - Atos
Workshop spring boot presentatie - Atos
 
Cultivating the jenkins job jungle with groovy - Patrick van Dissel
Cultivating the jenkins job jungle with groovy - Patrick van DisselCultivating the jenkins job jungle with groovy - Patrick van Dissel
Cultivating the jenkins job jungle with groovy - Patrick van Dissel
 
Rethink your architecture - Marten Deinum
Rethink your architecture - Marten DeinumRethink your architecture - Marten Deinum
Rethink your architecture - Marten Deinum
 
Evolutionary Algorithms: the key to solving complex Java puzzles! - Bas knopper
Evolutionary Algorithms: the key to solving complex Java puzzles! - Bas knopperEvolutionary Algorithms: the key to solving complex Java puzzles! - Bas knopper
Evolutionary Algorithms: the key to solving complex Java puzzles! - Bas knopper
 
Apache Wicket: 10 jaar en verder - Martijn Dashorst
Apache Wicket: 10 jaar en verder - Martijn DashorstApache Wicket: 10 jaar en verder - Martijn Dashorst
Apache Wicket: 10 jaar en verder - Martijn Dashorst
 
Opening - Bert Ertman
Opening - Bert ErtmanOpening - Bert Ertman
Opening - Bert Ertman
 
Returning the right results - Jettro Coenradie
Returning the right results - Jettro CoenradieReturning the right results - Jettro Coenradie
Returning the right results - Jettro Coenradie
 
Reactive programming met Java 8 en Java EE 7 - Martijn Blankestijn
Reactive programming met Java 8 en Java EE 7 - Martijn BlankestijnReactive programming met Java 8 en Java EE 7 - Martijn Blankestijn
Reactive programming met Java 8 en Java EE 7 - Martijn Blankestijn
 
Event-sourced architectures with Akka - Sander Mak
Event-sourced architectures with Akka - Sander MakEvent-sourced architectures with Akka - Sander Mak
Event-sourced architectures with Akka - Sander Mak
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
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...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

Modularity and Domain Driven Design; a killer Combination? - Tom de Wolf & Stijn van den Enden

  • 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. Software Design Customer Satisfaction Separation of Concerns initial development maintenance phase Low coupling High Cohesion B B A 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 owner transports from to
  • 4. Business Partner Context Domain Driven Design Modularity with Bounded Contexts Contact BusinessPartner Address Vehicle Option Make Warranty Owner Model Transported Item Transport Supplier Transport Transport Consumer from to Location Vehicle Context Transport Context
  • 5. MODULAR DATABASE SCHEMA transport NO foreign key vehicle TRANSPORTED_ITEM_ID FROM CONSUMER_ID djdfjfdkjdk221 454 BE1234567 foreign key LOCATION_ID ADDRESS 454 Sunstreet 23 business partner UUID MAKE MODEL OWNER_ID djdfjfdkjdk221 Ford C-Max BE1234567 VAT_NUMBER NAME BE1234567 Company A • cross domain database structures not allowed • queries cannot cross domain boundaries
  • 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 TxS cross domain search and reporting CHALLENGES
  • 9. MIGRATION CHALLENGE MDev Machine 1 Dev Machine 2 Continuous Integration Test environment Acceptance environment Version 1.0.0 Production environment 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 In versioned source code XML based DSL for changeSets www.liquibase.org DATABASECHANGELOG table to track executed changesets for each environment
  • 11. MMODULAR LIQUIBASE vehicle transport business partner deployment 1 deployment 2 deployment 3 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 Migrate modules separately Migrate @deploy of module
  • 12. MTHE 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? T1 transaction spanning multiple modular domains JTA not needed • even on 1 datasource • No persistence layer — direct jdbc/sql access — 1 datasource JTA required x • Multiple datasources • Different types of persistence layers (JPA, NoSQL, …) • JPA persistence layer in each domain bundle • instead of one big persistence unit
  • 15. T MODULAR PERSISTENCE transport-domain vehicle-domain osgi-datasource XA enabled javax.transaction.TransactionManager transaction provider e.g. atomikos javax.sql.DataSource persistence context persistence context commit x
  • 17. Scross domain search SEARCH the tale of the evil joins
  • 18. NO cross module search
  • 19. A. Search encapsulated in a separate module leveraging the functionality of other domain modules search-module domainA domainB x x Repository Repository Stop SearchAPI • requires specific implementation for every search • complexity increases with number of modules • inability to leverage power of the datastore
  • 20. Update Events SearchAPI EventProvider domainA B. Search is using a separate query model search-module domainB Update
  • 21.
  • 22. index document_type $ curl -XPUT ‘localhost:9200/vehicle/external/1’ -d ‘{ “make”: “BMW”, “VIN”: “30203232012102” id }’ Index a document
  • 23. Update a document index document_type $ curl -XPOST ‘localhost:9200/vehicle/external/1/ _update’ -d ‘{ “doc”: {“make”: “Alpina”} id }’
  • 24. index Querying an index $ curl -XPOST localhost:9200/vehicle/_search?pretty -d ‘{"query":{"match":{"make":"BMW"}}}'
  • 25. Querying an index $ curl -XPOST localhost:9200/vehicle/_search?pretty -d ‘{"query":{"match":{"mark":"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" : {"makes": "BMW", "VIN": "30203232012112"} } ]}}
  • 26. • Distributed (shards/replicas) • Advanced Quering (lucene/geo/ aggregation) • Facets (terms/ranges/histogram) • API (HTTP/Java/Java Testing) • … {
  • 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 update(entity) SearchIndexService Track updated entities A Map entities to searchData B Bulk update search index C Synchronise on Transaction
  • 30. 1B Map entities to searchData Populate the index 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. 1B Map entities to searchData SearchDataProvider Populate the index domainB Entity SearchData
  • 32. 1A Populate the index search update(entity) SearchIndexService Track updated entities Map entities to searchData B SearchDataProvider Bulk update search index C Synchronise on Transaction domainB
  • 35. 2search SearchService Enhancing Search 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" "km" SearchCriterionType.NUMBER SearchCriterionQueryType.RANGE_NUMBER "SERVICE_ITEM"
  • 37. 2Enhancing Search search SearchService domainB SearchCriteriaProvider domainB
  • 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? Migration 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 Cross domain search and reporting Domain Specific Query Language Exploiting elastic search capabilities beyond search, e.g. reporting
  • 40. MModular migration Liquibase extender @ DeployTCross domain transactions SCross domain search x Distributed JTA transactionsElasticsearch 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