SlideShare a Scribd company logo
© 2014 OXID eSales AG 
How To Map Domain Changes 
On An Existing Database 
OXID eSales AG 
Philip Washington Sorst 
Software Architect
© 2014 OXID eSales AG 
An Example: The Article 
Article 
id 
title 
pic1 
pic2 
pic3
position 
© 2014 OXID eSales AG 
An Example: The Product 
id 
1 of n 
Product Picture 
title path
Web Frontend REST 
© 2014 OXID eSales AG 
Architecture (1) 
Controller 
Repositories 
Presentation Layer 
Data Layer
Web Frontend REST 
© 2014 OXID eSales AG 
Architecture (2) 
Controller 
Domain Services 
Repositories 
Presentation Layer 
Business Logic Layer 
Data Layer
ProductController 
ProductServiceInterface CategoryServiceInterface 
© 2014 OXID eSales AG 
The Business Logic Layer 
ProductService CategoryService 
DomainEntities DomainEntities 
Data Layer
© 2014 OXID eSales AG 
An Example: The ProductInterface 
interface ProductInterface 
{ 
function getId(); 
function getTitle(); 
function setTitle($title); 
function getPictures(); 
function setPictureAt($position, $path); 
}
© 2014 OXID eSales AG 
An Example: The ProductWrapper 
class ProductWrapper implements ProductInterface 
{ 
protected $article; 
function getId() { $this­> 
article­> 
getId(); } 
function getPictures() 
{ 
return array( 
$this­> 
article­> 
getPic1(), 
$this­> 
article­> 
getPic2(), 
$this­> 
article­> 
getPic3()); 
} 
... 
}
Business Logic Layer 
Data Layer 
queries DomainEntityInterface 
© 2014 OXID eSales AG 
The Data Layer 
Repository 
DAO 
Service 
Mapper 
DatabaseEntityWrapper 
DatabaseEntity 
Row 
queries 
maps 
returns 
builds 
queries
© 2014 OXID eSales AG 
/** 
* @ORMTable() 
* @ORMEntity() 
*/ 
class Product implements ProductInterface 
{ 
/** 
* @ORMColumn(name="id", type="integer") 
* @ORMId 
* @ORMGeneratedValue(strategy="AUTO") 
*/ 
private $id; 
/** @ORMColumn(name="title", type="string", length=255) */ 
private $title; 
/** @ORMOneToMany(targetEntity="Picture", mappedBy="article", 
cascade={"ALL"}, indexBy="picture") */ 
private $pictures;
© 2014 OXID eSales AG 
Migration 
MigrationService 
LegacyRepository DoctrineRepository 
LegacyDao 
DomainEntityConverter 
LegacyDB TargetDB
© 2014 OXID eSales AG 
Why we are using Symfony 
> Open Source 
> Focus on clean OO Development (DI, Events) 
> Is more than a web framework 
> Can be introduced step by step 
> We don't need to reinvent the wheel, great bundles available 
> We need to be easily extendable, so building bundles ourself 
> Mature and well supported 
> Superior Documentation
© 2014 OXID eSales AG 
Discussion: The Cons 
> Performance might become an issue 
– But our layered architecture allows us easily cache stuff 
and build performance optimized services 
> The wrapping needs much love (=time) to be fully backwards 
compatible, testing 
> Of course there are still some modelling limitations imposed
© 2014 OXID eSales AG 
Discussion: The Pros 
> A redefined view on our own domain, built for the future 
> We don't break things too early 
> Design flaws can be identified and removed 
> Things become exchangable, as soon as migration is possible 
the wrapping will vanish 
> Implicit migration for the database. Use the wrapper layer to 
read, use the new domain to write
© 2014 OXID eSales AG 
Credits 
> Icons: 
– Shmidt Sergey (The Noun Project)
Thank you for your attention! 
© 2014 OXID eSales AG 
OXID eSales AG 
Bertoldstraße 48 
79098 Freiburg 
GERMANY 
www.oxid-esales.com 
E-Mail: info@oxid-esales.com 
Fon: +49 761 368 89 0

More Related Content

ODP
New software despite legacy DB
PDF
RFC 7807 - Communicating the Problem
PPTX
Azure Saturday 2017 - Planning for the Cloud
PPTX
Azure Saturday 2017 - Hold my beer...
PDF
Ektron and Rackspace Datasheet
PPTX
Hsbcad from acad to revit to cloud
PDF
Introduction to Cloud Computing
PPTX
Openstack portal-bestpractices-campbell mcneill
New software despite legacy DB
RFC 7807 - Communicating the Problem
Azure Saturday 2017 - Planning for the Cloud
Azure Saturday 2017 - Hold my beer...
Ektron and Rackspace Datasheet
Hsbcad from acad to revit to cloud
Introduction to Cloud Computing
Openstack portal-bestpractices-campbell mcneill

What's hot (18)

PPTX
Deploying Kubernetes on AWS Using Terraform
PPTX
Forge - DevCon 2017, Darmstadt Germany: Control & program a real robot by man...
PDF
Forge - DevCon 2017, Darmstadt Germany: Innovate with Forge
PDF
API Management: La Puerta de enlace (por Francisco Nieto)
PDF
Developing 3D Visualization Apps
PDF
AWS Finland Meetup 2019 April
PDF
Aws re invent 2014 feedback
PDF
DevTest Labs en Azure (por Iván Cañizares)
PPTX
Cloud Builders Meetup - Containers @ Autodesk
PPTX
BIML- What is it good for?
PDF
What's New in KNIME Analytics Platform 4.1
PPTX
Microsoft Azure News - Apr 2017
PPTX
BizTalk Server 2016: What’s new
PDF
Forge - DevCon 2016: Drawings! Drawings! Everywhere!
PDF
Event Report - Kronos KronosWorks - Solid progress and big things loom
PDF
Forge - DevCon 2017, Darmstadt Germany: Moving to Forge and the Cloud with yo...
PDF
Forge - DevCon 2017, Darmstadt Germany: HFDM - What, why & how?
PPTX
Forge - DevCon 2017, Darmstadt Germany: Integrating Forge Data Management API...
Deploying Kubernetes on AWS Using Terraform
Forge - DevCon 2017, Darmstadt Germany: Control & program a real robot by man...
Forge - DevCon 2017, Darmstadt Germany: Innovate with Forge
API Management: La Puerta de enlace (por Francisco Nieto)
Developing 3D Visualization Apps
AWS Finland Meetup 2019 April
Aws re invent 2014 feedback
DevTest Labs en Azure (por Iván Cañizares)
Cloud Builders Meetup - Containers @ Autodesk
BIML- What is it good for?
What's New in KNIME Analytics Platform 4.1
Microsoft Azure News - Apr 2017
BizTalk Server 2016: What’s new
Forge - DevCon 2016: Drawings! Drawings! Everywhere!
Event Report - Kronos KronosWorks - Solid progress and big things loom
Forge - DevCon 2017, Darmstadt Germany: Moving to Forge and the Cloud with yo...
Forge - DevCon 2017, Darmstadt Germany: HFDM - What, why & how?
Forge - DevCon 2017, Darmstadt Germany: Integrating Forge Data Management API...
Ad

Similar to How to map Domain changes on an existing Database (20)

PDF
Open Architecture in the Adobe Marketing Cloud - Summit 2014
PPTX
Oracle ICS Best Practises - 1st Presented at Oracle Partner PaaS Forum by Phi...
PPTX
VisiQuate: Azure cloud migration case study
PDF
Creating an all-purpose REST API for Cloud services using OSGi and Sling - C ...
PDF
Running SOA in the Cloud: SOA CS for SOA Suite Customers
PPT
Continuous Delivery to the cloud - Innovate 2014
PPTX
Sightly_techInsight
PPTX
Real World Modern Development Use Cases with RackHD and Adobe
PDF
56k.cloud training
PPTX
Surviving the Azure Avalanche
DOCX
Azure Administration.docx
PDF
[Cloud OnAir] Talks by DevRel Vol.4 データ管理とデータ ベース 2020年8月27日 放送
PDF
Moving OBIEE to Oracle Analytics Cloud
PDF
DevOps Case Studies
PPTX
Dockerizing apps for the Deployment Platform of the Month with OSGi - David B...
PDF
By Popular Demand: The Rise of Elastic SQL
PPTX
Strengthening Operations with Splunk and AWS CloudTrail
PDF
Supercharge Your Spring Boot Apps!
PPTX
Discover Smart Solutions for Enterprise Cloud Storage on Amazon Web Services
PPTX
Big Data Best Practices on GCP
Open Architecture in the Adobe Marketing Cloud - Summit 2014
Oracle ICS Best Practises - 1st Presented at Oracle Partner PaaS Forum by Phi...
VisiQuate: Azure cloud migration case study
Creating an all-purpose REST API for Cloud services using OSGi and Sling - C ...
Running SOA in the Cloud: SOA CS for SOA Suite Customers
Continuous Delivery to the cloud - Innovate 2014
Sightly_techInsight
Real World Modern Development Use Cases with RackHD and Adobe
56k.cloud training
Surviving the Azure Avalanche
Azure Administration.docx
[Cloud OnAir] Talks by DevRel Vol.4 データ管理とデータ ベース 2020年8月27日 放送
Moving OBIEE to Oracle Analytics Cloud
DevOps Case Studies
Dockerizing apps for the Deployment Platform of the Month with OSGi - David B...
By Popular Demand: The Rise of Elastic SQL
Strengthening Operations with Splunk and AWS CloudTrail
Supercharge Your Spring Boot Apps!
Discover Smart Solutions for Enterprise Cloud Storage on Amazon Web Services
Big Data Best Practices on GCP
Ad

Recently uploaded (20)

PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
Transform Your Business with a Software ERP System
PPTX
ai tools demonstartion for schools and inter college
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Nekopoi APK 2025 free lastest update
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
top salesforce developer skills in 2025.pdf
Wondershare Filmora 15 Crack With Activation Key [2025
Internet Downloader Manager (IDM) Crack 6.42 Build 41
VVF-Customer-Presentation2025-Ver1.9.pptx
Transform Your Business with a Software ERP System
ai tools demonstartion for schools and inter college
Softaken Excel to vCard Converter Software.pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PTS Company Brochure 2025 (1).pdf.......
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Designing Intelligence for the Shop Floor.pdf
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Design an Analysis of Algorithms I-SECS-1021-03
CHAPTER 2 - PM Management and IT Context
Nekopoi APK 2025 free lastest update
2025 Textile ERP Trends: SAP, Odoo & Oracle
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
top salesforce developer skills in 2025.pdf

How to map Domain changes on an existing Database

  • 1. © 2014 OXID eSales AG How To Map Domain Changes On An Existing Database OXID eSales AG Philip Washington Sorst Software Architect
  • 2. © 2014 OXID eSales AG An Example: The Article Article id title pic1 pic2 pic3
  • 3. position © 2014 OXID eSales AG An Example: The Product id 1 of n Product Picture title path
  • 4. Web Frontend REST © 2014 OXID eSales AG Architecture (1) Controller Repositories Presentation Layer Data Layer
  • 5. Web Frontend REST © 2014 OXID eSales AG Architecture (2) Controller Domain Services Repositories Presentation Layer Business Logic Layer Data Layer
  • 6. ProductController ProductServiceInterface CategoryServiceInterface © 2014 OXID eSales AG The Business Logic Layer ProductService CategoryService DomainEntities DomainEntities Data Layer
  • 7. © 2014 OXID eSales AG An Example: The ProductInterface interface ProductInterface { function getId(); function getTitle(); function setTitle($title); function getPictures(); function setPictureAt($position, $path); }
  • 8. © 2014 OXID eSales AG An Example: The ProductWrapper class ProductWrapper implements ProductInterface { protected $article; function getId() { $this­> article­> getId(); } function getPictures() { return array( $this­> article­> getPic1(), $this­> article­> getPic2(), $this­> article­> getPic3()); } ... }
  • 9. Business Logic Layer Data Layer queries DomainEntityInterface © 2014 OXID eSales AG The Data Layer Repository DAO Service Mapper DatabaseEntityWrapper DatabaseEntity Row queries maps returns builds queries
  • 10. © 2014 OXID eSales AG /** * @ORMTable() * @ORMEntity() */ class Product implements ProductInterface { /** * @ORMColumn(name="id", type="integer") * @ORMId * @ORMGeneratedValue(strategy="AUTO") */ private $id; /** @ORMColumn(name="title", type="string", length=255) */ private $title; /** @ORMOneToMany(targetEntity="Picture", mappedBy="article", cascade={"ALL"}, indexBy="picture") */ private $pictures;
  • 11. © 2014 OXID eSales AG Migration MigrationService LegacyRepository DoctrineRepository LegacyDao DomainEntityConverter LegacyDB TargetDB
  • 12. © 2014 OXID eSales AG Why we are using Symfony > Open Source > Focus on clean OO Development (DI, Events) > Is more than a web framework > Can be introduced step by step > We don't need to reinvent the wheel, great bundles available > We need to be easily extendable, so building bundles ourself > Mature and well supported > Superior Documentation
  • 13. © 2014 OXID eSales AG Discussion: The Cons > Performance might become an issue – But our layered architecture allows us easily cache stuff and build performance optimized services > The wrapping needs much love (=time) to be fully backwards compatible, testing > Of course there are still some modelling limitations imposed
  • 14. © 2014 OXID eSales AG Discussion: The Pros > A redefined view on our own domain, built for the future > We don't break things too early > Design flaws can be identified and removed > Things become exchangable, as soon as migration is possible the wrapping will vanish > Implicit migration for the database. Use the wrapper layer to read, use the new domain to write
  • 15. © 2014 OXID eSales AG Credits > Icons: – Shmidt Sergey (The Noun Project)
  • 16. Thank you for your attention! © 2014 OXID eSales AG OXID eSales AG Bertoldstraße 48 79098 Freiburg GERMANY www.oxid-esales.com E-Mail: info@oxid-esales.com Fon: +49 761 368 89 0

Editor's Notes

  • #2: Verweis Gigi: Domain Driven Design → Technik Vorstellung von Ideen und Konzepten in SoftwareArchitektur und Datenbankmodellierung Wir haben die Chance, weil die existierende Domäne sehr vollständig ist Geringe Komplexität der Beispiele Work in progress
  • #3: Von dem erwähnten Artikel Beispiel ausgehend Domäne in DB abgebildet → ER Kurz (Domain)Entität definieren Angenommen wir haben drei Bilder an einem Artikel nicht normalisiert wegen begrenzter Anzeigemöglichkeiten und “Performance” Prämisse: Datenbank darf nicht verändert! werden
  • #4: Modellierung des Produkts, anderer Name, ein Produkt ist quasi “nichts” außer einer id (im Beispiel noch mit title, auch das kann man rausextrahieren) Die Bilder sollen getrennt sein, sind quasi nur für die Präsentation da Modellierung als “weak entity” als Beispiel, Komplexität beliebig erhöhbar Die Thematik des Vortrags ist: Wie nutze ich eine Datenbank, die wie das erste Beispiel organisiert ist, aber das zweite Beispiel repräsentieren soll
  • #5: Simpelstes Symfony Beispiel Controller laufen direkt gegen DB, gut für kleine Seiten, ein paar versteckte “Services” Was wir wollen, dünne Controller, klare Schnittstellen
  • #6: Wir benutzen dedizierten Business Logic Layer Trennen Datenbank von Presentation Data Layer muss austauschbar sein Business Logic Layer als Definition der unterstützten Domänenoperationen, Workflows Schichtenarchitektur bedeutet auch, keine Schicht darf übersprungen werden
  • #7: Durch Interfaces definiert Spezifizieren die API → müssen stabil bleiben Wer seine Domäne nicht schützt hat keine Chance auf Versionierung → Partner Sind der einzige Platz in der Business Logik (Workflows) stattfinden, nicht Controller, nicht Data Layer Verarbeiten Domänenobjekte Dependency Injection bietet Flexibilität (Erweiterbarkeit, Customizability), Crucial Beispiel: ElasticSearch Die Frage: wie definieren wir DomänenObjekte
  • #8: Introduction POPO Wir definieren DomainEntities als Interface Beschreibung dessen WAS sie repräsentieren, aber nicht WIE Art der Repräsentation wird austauschbar
  • #9: Beispiel für das WIE Verhalten bleibt nach außen konsistent Wrapping ist eine Möglichkeit, es ist auch möglich mit Transformation zu arbeiten
  • #10: Wie kommen wir von der Datenbank zur Domäne DAO (erklären, DBAL) fragt DB, bekommt Row Wir wollen DatabaseEntity (teilweise angebasst) => custom Mapping Warum kein ORM? Bei uns nicht machbar Zugriff auf die Datenbank NUR über DAO Von da zum DomainEntity: Repository exposed Datenzugriff transparent nach außen Transformationen finden im Repository statt, kann beliebig komplex sein Vergleiche ORM Repository
  • #11: Idealerweise lässt sich unsere Domäne in einer relationalen Datenbank repräsentieren (Sauberes) ORM lässt sich umsetzen, POPO Repository lässt sich ersetzen, Overhead fällt weg
  • #12: Nebeneffekt: Es lässt sich Datenbank Migration durchführen Wir haben die Möglichkeit über unseren Adapter Layer die “legacy” DB als neues DomainEntity zu lesen Übersetzen in ORM Implementierung Speichern über neues Repository Könnten Upgrade Pfad anbieten Warum keine Doctrine Schema Migration?
  • #13: Extendable → Partners
  • #14: Gefahr der Überabstrahierung, aber große Domäne
  • #15: Kontinuierlicher Prozess
  • #17: <number>