SlideShare a Scribd company logo

Brownfield Domain Driven Design

Nicolò Pignatelli
Nicolò Pignatelli
Nicolò PignatelliDirector of Engineering @ Rocket Labs GmbH at Rocket Labs GmbH & Co.KG

One of the main advantages of PHP is that it allows you and your company to build up projects in no time and with immediate feedback and business value. Sometimes, however, fast growth and unprevented complexities could make your codebase more and more difficult to manage as time passes and new features are added.Domain Driven Design can be an elegant solution to the problem, but introducing it in mid-large sized projects is not always easy: you have to deal with difficulties at technical, team and knowledge levels. This talk focuses on how to approach the change in your codebase and in your team mindset without breaking legacy code or stopping the development in favor of neverending refactoring sessions.

Brownfield Domain Driven Design

1 of 42
Download to read offline
Brownfield
Domain Driven
Design
Bring your project to the next level
without breaking things (nor people)
About me
@nicolopigna
- PHP developer
- Team leader / Software engineer at Rocket Labs, Berlin
We proudly run Seller Center, the largest Rocket Internet
Marketplace solution.
Popular clients: Zalando (Europe), Lazada (south Asia),
Linio (south America), Global Fashion Group
Why “Brownfield”?
More challenging and fun than greenfield!
Majority of cases.
Open knowledge harder to find.
Examples start from the assumption of a greenfield.
“Greenfield is exciting at first, but taking a brownfield project and
giving it new life, well, is just priceless!”
Me on Twitter
Why Domain Driven Design?
● Non-trivial domain model
● Linguistic boundaries applied to
the code
● Design and code reflect the
same concepts 1:1
● Iterative knowledge distillation
● Both tactical and strategic tools
No, let’s not
CRUDish applications
Generic subdomains
Yes, we can
● In your core domain
● In heavy business-logic
parts of your application
● In strategic supporting
domains
Where should I apply it?
i.e. where you make most of your
money.
Can we outsource or buy it? Then it’s
one of those.
Is it difficult? How do we change?
Team
● learn new concepts
● mindshift is not immediate
● eradicate CRUD design
● design business first, then data
structures
Management
● handle the change
● manage adaptation time
● active part of design process
Organisation
● involve business experts
● face potential change
● introspect processes
Ad

Recommended

Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven DesignRyan Riley
 
Domain Driven Design - Strategic Patterns and Microservices
Domain Driven Design - Strategic Patterns and MicroservicesDomain Driven Design - Strategic Patterns and Microservices
Domain Driven Design - Strategic Patterns and MicroservicesRadosław Maziarka
 
Domain Driven Design(DDD) Presentation
Domain Driven Design(DDD) PresentationDomain Driven Design(DDD) Presentation
Domain Driven Design(DDD) PresentationOğuzhan Soykan
 
Domain Driven Design (Ultra) Distilled
Domain Driven Design (Ultra) DistilledDomain Driven Design (Ultra) Distilled
Domain Driven Design (Ultra) DistilledNicola Costantino
 
Implementing Microservices by DDD
Implementing Microservices by DDDImplementing Microservices by DDD
Implementing Microservices by DDDAmazon Web Services
 
Clean architecture with ddd layering in php
Clean architecture with ddd layering in phpClean architecture with ddd layering in php
Clean architecture with ddd layering in phpLeonardo Proietti
 

More Related Content

What's hot

Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven DesignYoung-Ho Cho
 
Domain Driven Design (DDD)
Domain Driven Design (DDD)Domain Driven Design (DDD)
Domain Driven Design (DDD)Tom Kocjan
 
Domain driven design
Domain driven designDomain driven design
Domain driven designits_skm
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven DesignNader Albert
 
Hexagonal architecture for java applications
Hexagonal architecture for java applicationsHexagonal architecture for java applications
Hexagonal architecture for java applicationsFabricio Epaminondas
 
D2 domain driven-design
D2 domain driven-designD2 domain driven-design
D2 domain driven-designArnaud Bouchez
 
Domain Driven Design: Zero to Hero
Domain Driven Design: Zero to HeroDomain Driven Design: Zero to Hero
Domain Driven Design: Zero to HeroFabrício Rissetto
 
An introduction to fundamental architecture concepts
An introduction to fundamental architecture conceptsAn introduction to fundamental architecture concepts
An introduction to fundamental architecture conceptswweinmeyer79
 
Togaf 9.1 ADM summary
Togaf 9.1 ADM summaryTogaf 9.1 ADM summary
Togaf 9.1 ADM summaryMarco Bakker
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introductionwojtek_s
 
How to pass ArchiMate 3.1 Practitioner exam
How to pass ArchiMate 3.1 Practitioner examHow to pass ArchiMate 3.1 Practitioner exam
How to pass ArchiMate 3.1 Practitioner examAshraf Fouad
 
Modelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven DesignModelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven DesignNaeem Sarfraz
 
Onion Architecture / Clean Architecture
Onion Architecture / Clean ArchitectureOnion Architecture / Clean Architecture
Onion Architecture / Clean ArchitectureAttila Bertók
 
Hexagonal architecture with Spring Boot
Hexagonal architecture with Spring BootHexagonal architecture with Spring Boot
Hexagonal architecture with Spring BootMikalai Alimenkou
 
Low level design template (1)
Low level design template (1)Low level design template (1)
Low level design template (1)anosha jamshed
 
Hexagonal Architecture
Hexagonal ArchitectureHexagonal Architecture
Hexagonal ArchitectureMarcelo Cure
 

What's hot (20)

Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Domain Driven Design (DDD)
Domain Driven Design (DDD)Domain Driven Design (DDD)
Domain Driven Design (DDD)
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Hexagonal architecture for java applications
Hexagonal architecture for java applicationsHexagonal architecture for java applications
Hexagonal architecture for java applications
 
Domain Driven Design
Domain Driven Design Domain Driven Design
Domain Driven Design
 
D2 domain driven-design
D2 domain driven-designD2 domain driven-design
D2 domain driven-design
 
Domain Driven Design: Zero to Hero
Domain Driven Design: Zero to HeroDomain Driven Design: Zero to Hero
Domain Driven Design: Zero to Hero
 
An introduction to fundamental architecture concepts
An introduction to fundamental architecture conceptsAn introduction to fundamental architecture concepts
An introduction to fundamental architecture concepts
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Togaf 9.1 ADM summary
Togaf 9.1 ADM summaryTogaf 9.1 ADM summary
Togaf 9.1 ADM summary
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introduction
 
How to pass ArchiMate 3.1 Practitioner exam
How to pass ArchiMate 3.1 Practitioner examHow to pass ArchiMate 3.1 Practitioner exam
How to pass ArchiMate 3.1 Practitioner exam
 
Modelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven DesignModelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven Design
 
Onion Architecture / Clean Architecture
Onion Architecture / Clean ArchitectureOnion Architecture / Clean Architecture
Onion Architecture / Clean Architecture
 
CQRS and Event Sourcing
CQRS and Event SourcingCQRS and Event Sourcing
CQRS and Event Sourcing
 
Introduction to DDD
Introduction to DDDIntroduction to DDD
Introduction to DDD
 
Hexagonal architecture with Spring Boot
Hexagonal architecture with Spring BootHexagonal architecture with Spring Boot
Hexagonal architecture with Spring Boot
 
Low level design template (1)
Low level design template (1)Low level design template (1)
Low level design template (1)
 
Hexagonal Architecture
Hexagonal ArchitectureHexagonal Architecture
Hexagonal Architecture
 

Similar to Brownfield Domain Driven Design

Php melb cqrs-ddd-predaddy
Php melb cqrs-ddd-predaddyPhp melb cqrs-ddd-predaddy
Php melb cqrs-ddd-predaddyDouglas Reith
 
IT for HR professionals
IT for HR professionalsIT for HR professionals
IT for HR professionalsMiguel Pinto
 
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Bill Buchan
 
Domain driven design: a gentle introduction
Domain driven design:  a gentle introductionDomain driven design:  a gentle introduction
Domain driven design: a gentle introductionAsher Sterkin
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven DesignMuhammad Ali
 
Adopting Domain-Driven Design in your organization
Adopting Domain-Driven Design in your organizationAdopting Domain-Driven Design in your organization
Adopting Domain-Driven Design in your organizationAleix Morgadas
 
Designing Powerful Web Applications - Monterey
Designing Powerful Web Applications - MontereyDesigning Powerful Web Applications - Monterey
Designing Powerful Web Applications - MontereyDave Malouf
 
ASAS 2014 - Simon Brown
ASAS 2014 - Simon BrownASAS 2014 - Simon Brown
ASAS 2014 - Simon BrownAvisi B.V.
 
Microservices as an evolutionary architecture: lessons learned
Microservices as an evolutionary architecture: lessons learnedMicroservices as an evolutionary architecture: lessons learned
Microservices as an evolutionary architecture: lessons learnedLuram Archanjo
 
Refreshing Domain Driven Design
Refreshing Domain Driven DesignRefreshing Domain Driven Design
Refreshing Domain Driven DesignAndré Borgonovo
 
DITA and Localization: Bringing the Best Together
DITA and Localization: Bringing the Best TogetherDITA and Localization: Bringing the Best Together
DITA and Localization: Bringing the Best TogetherLavaCon
 
Designing Powerful Web Applications Using AJAX and Other RIAs
Designing Powerful Web Applications Using AJAX and Other RIAsDesigning Powerful Web Applications Using AJAX and Other RIAs
Designing Powerful Web Applications Using AJAX and Other RIAsDave Malouf
 
Idiomatic Domain Driven Design: implementing CQRS
Idiomatic Domain Driven Design: implementing CQRSIdiomatic Domain Driven Design: implementing CQRS
Idiomatic Domain Driven Design: implementing CQRSAndrea Saltarello
 
Deprecating the state machine: building conversational AI with the Rasa stack...
Deprecating the state machine: building conversational AI with the Rasa stack...Deprecating the state machine: building conversational AI with the Rasa stack...
Deprecating the state machine: building conversational AI with the Rasa stack...PyData
 
Deprecating the state machine: building conversational AI with the Rasa stack
Deprecating the state machine: building conversational AI with the Rasa stackDeprecating the state machine: building conversational AI with the Rasa stack
Deprecating the state machine: building conversational AI with the Rasa stackJustina Petraitytė
 

Similar to Brownfield Domain Driven Design (20)

Php melb cqrs-ddd-predaddy
Php melb cqrs-ddd-predaddyPhp melb cqrs-ddd-predaddy
Php melb cqrs-ddd-predaddy
 
IT for HR professionals
IT for HR professionalsIT for HR professionals
IT for HR professionals
 
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
 
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
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Adopting Domain-Driven Design in your organization
Adopting Domain-Driven Design in your organizationAdopting Domain-Driven Design in your organization
Adopting Domain-Driven Design in your organization
 
Designing Powerful Web Applications - Monterey
Designing Powerful Web Applications - MontereyDesigning Powerful Web Applications - Monterey
Designing Powerful Web Applications - Monterey
 
ASAS 2014 - Simon Brown
ASAS 2014 - Simon BrownASAS 2014 - Simon Brown
ASAS 2014 - Simon Brown
 
Microservices as an evolutionary architecture: lessons learned
Microservices as an evolutionary architecture: lessons learnedMicroservices as an evolutionary architecture: lessons learned
Microservices as an evolutionary architecture: lessons learned
 
DDD In Agile
DDD In Agile   DDD In Agile
DDD In Agile
 
Let's talk about... Microservices
Let's talk about... MicroservicesLet's talk about... Microservices
Let's talk about... Microservices
 
Microservices Architecture
Microservices ArchitectureMicroservices Architecture
Microservices Architecture
 
Into the domain
Into the domainInto the domain
Into the domain
 
Refreshing Domain Driven Design
Refreshing Domain Driven DesignRefreshing Domain Driven Design
Refreshing Domain Driven Design
 
DITA and Localization: Bringing the Best Together
DITA and Localization: Bringing the Best TogetherDITA and Localization: Bringing the Best Together
DITA and Localization: Bringing the Best Together
 
Designing Powerful Web Applications Using AJAX and Other RIAs
Designing Powerful Web Applications Using AJAX and Other RIAsDesigning Powerful Web Applications Using AJAX and Other RIAs
Designing Powerful Web Applications Using AJAX and Other RIAs
 
Idiomatic Domain Driven Design: implementing CQRS
Idiomatic Domain Driven Design: implementing CQRSIdiomatic Domain Driven Design: implementing CQRS
Idiomatic Domain Driven Design: implementing CQRS
 
Deprecating the state machine: building conversational AI with the Rasa stack...
Deprecating the state machine: building conversational AI with the Rasa stack...Deprecating the state machine: building conversational AI with the Rasa stack...
Deprecating the state machine: building conversational AI with the Rasa stack...
 
Deprecating the state machine: building conversational AI with the Rasa stack
Deprecating the state machine: building conversational AI with the Rasa stackDeprecating the state machine: building conversational AI with the Rasa stack
Deprecating the state machine: building conversational AI with the Rasa stack
 

Recently uploaded

Bit N Build Poland
Bit N Build PolandBit N Build Poland
Bit N Build PolandGDSC PJATK
 
Bringing nullability into existing code - dammit is not the answer.pptx
Bringing nullability into existing code - dammit is not the answer.pptxBringing nullability into existing code - dammit is not the answer.pptx
Bringing nullability into existing code - dammit is not the answer.pptxMaarten Balliauw
 
"Journey of Aspiration: Unveiling the Path to Becoming a Technocrat and Entre...
"Journey of Aspiration: Unveiling the Path to Becoming a Technocrat and Entre..."Journey of Aspiration: Unveiling the Path to Becoming a Technocrat and Entre...
"Journey of Aspiration: Unveiling the Path to Becoming a Technocrat and Entre...shaiyuvasv
 
Zi-Stick UBS Dongle ZIgbee from Aeotec manual
Zi-Stick UBS Dongle ZIgbee from  Aeotec manualZi-Stick UBS Dongle ZIgbee from  Aeotec manual
Zi-Stick UBS Dongle ZIgbee from Aeotec manualDomotica daVinci
 
2024 February Patch Tuesday
2024 February Patch Tuesday2024 February Patch Tuesday
2024 February Patch TuesdayIvanti
 
Power of 2024 - WITforce Odyssey.pptx.pdf
Power of 2024 - WITforce Odyssey.pptx.pdfPower of 2024 - WITforce Odyssey.pptx.pdf
Power of 2024 - WITforce Odyssey.pptx.pdfkatalinjordans1
 
Breaking Barriers & Leveraging the Latest Developments in AI Technology
Breaking Barriers & Leveraging the Latest Developments in AI TechnologyBreaking Barriers & Leveraging the Latest Developments in AI Technology
Breaking Barriers & Leveraging the Latest Developments in AI TechnologySafe Software
 
Q1 Memory Fabric Forum: SMART CXL Product Lineup
Q1 Memory Fabric Forum: SMART CXL Product LineupQ1 Memory Fabric Forum: SMART CXL Product Lineup
Q1 Memory Fabric Forum: SMART CXL Product LineupMemory Fabric Forum
 
M.Aathiraju Self Intro.docx-AD21001_____
M.Aathiraju Self Intro.docx-AD21001_____M.Aathiraju Self Intro.docx-AD21001_____
M.Aathiraju Self Intro.docx-AD21001_____Aathiraju
 
Enhancing SaaS Performance: A Hands-on Workshop for Partners
Enhancing SaaS Performance: A Hands-on Workshop for PartnersEnhancing SaaS Performance: A Hands-on Workshop for Partners
Enhancing SaaS Performance: A Hands-on Workshop for PartnersThousandEyes
 
Early Tech Adoption: Foolish or Pragmatic? - 17th ISACA South Florida WOW Con...
Early Tech Adoption: Foolish or Pragmatic? - 17th ISACA South Florida WOW Con...Early Tech Adoption: Foolish or Pragmatic? - 17th ISACA South Florida WOW Con...
Early Tech Adoption: Foolish or Pragmatic? - 17th ISACA South Florida WOW Con...Adrian Sanabria
 
21ST CENTURY LITERACY FROM TRADITIONAL TO MODERN
21ST CENTURY LITERACY FROM TRADITIONAL TO MODERN21ST CENTURY LITERACY FROM TRADITIONAL TO MODERN
21ST CENTURY LITERACY FROM TRADITIONAL TO MODERNRonnelBaroc
 
My sample product research idea for you!
My sample product research idea for you!My sample product research idea for you!
My sample product research idea for you!KivenRaySarsaba
 
DNA LIGASE BIOTECHNOLOGY BIOLOGY STUDY OF LIFE
DNA LIGASE BIOTECHNOLOGY BIOLOGY STUDY OF LIFEDNA LIGASE BIOTECHNOLOGY BIOLOGY STUDY OF LIFE
DNA LIGASE BIOTECHNOLOGY BIOLOGY STUDY OF LIFEandreiandasan
 
Avoiding Bad Stats and the Benefits of Playing Trivia with Friends: PancakesC...
Avoiding Bad Stats and the Benefits of Playing Trivia with Friends: PancakesC...Avoiding Bad Stats and the Benefits of Playing Trivia with Friends: PancakesC...
Avoiding Bad Stats and the Benefits of Playing Trivia with Friends: PancakesC...Adrian Sanabria
 
Manual Eurotronic Thermostatic Valve Comry Z-Wave
Manual Eurotronic Thermostatic Valve Comry Z-WaveManual Eurotronic Thermostatic Valve Comry Z-Wave
Manual Eurotronic Thermostatic Valve Comry Z-WaveDomotica daVinci
 
AWS reInvent 2023 recaps from Chicago AWS user group
AWS reInvent 2023 recaps from Chicago AWS user groupAWS reInvent 2023 recaps from Chicago AWS user group
AWS reInvent 2023 recaps from Chicago AWS user groupAWS Chicago
 
Importance of magazines in education ppt
Importance of magazines in education pptImportance of magazines in education ppt
Importance of magazines in education pptsafnarafeek2002
 

Recently uploaded (20)

Bit N Build Poland
Bit N Build PolandBit N Build Poland
Bit N Build Poland
 
Bringing nullability into existing code - dammit is not the answer.pptx
Bringing nullability into existing code - dammit is not the answer.pptxBringing nullability into existing code - dammit is not the answer.pptx
Bringing nullability into existing code - dammit is not the answer.pptx
 
"Journey of Aspiration: Unveiling the Path to Becoming a Technocrat and Entre...
"Journey of Aspiration: Unveiling the Path to Becoming a Technocrat and Entre..."Journey of Aspiration: Unveiling the Path to Becoming a Technocrat and Entre...
"Journey of Aspiration: Unveiling the Path to Becoming a Technocrat and Entre...
 
Zi-Stick UBS Dongle ZIgbee from Aeotec manual
Zi-Stick UBS Dongle ZIgbee from  Aeotec manualZi-Stick UBS Dongle ZIgbee from  Aeotec manual
Zi-Stick UBS Dongle ZIgbee from Aeotec manual
 
2024 February Patch Tuesday
2024 February Patch Tuesday2024 February Patch Tuesday
2024 February Patch Tuesday
 
COE AI Lab Universities
COE AI Lab UniversitiesCOE AI Lab Universities
COE AI Lab Universities
 
Power of 2024 - WITforce Odyssey.pptx.pdf
Power of 2024 - WITforce Odyssey.pptx.pdfPower of 2024 - WITforce Odyssey.pptx.pdf
Power of 2024 - WITforce Odyssey.pptx.pdf
 
Breaking Barriers & Leveraging the Latest Developments in AI Technology
Breaking Barriers & Leveraging the Latest Developments in AI TechnologyBreaking Barriers & Leveraging the Latest Developments in AI Technology
Breaking Barriers & Leveraging the Latest Developments in AI Technology
 
Q1 Memory Fabric Forum: SMART CXL Product Lineup
Q1 Memory Fabric Forum: SMART CXL Product LineupQ1 Memory Fabric Forum: SMART CXL Product Lineup
Q1 Memory Fabric Forum: SMART CXL Product Lineup
 
M.Aathiraju Self Intro.docx-AD21001_____
M.Aathiraju Self Intro.docx-AD21001_____M.Aathiraju Self Intro.docx-AD21001_____
M.Aathiraju Self Intro.docx-AD21001_____
 
Enhancing SaaS Performance: A Hands-on Workshop for Partners
Enhancing SaaS Performance: A Hands-on Workshop for PartnersEnhancing SaaS Performance: A Hands-on Workshop for Partners
Enhancing SaaS Performance: A Hands-on Workshop for Partners
 
Early Tech Adoption: Foolish or Pragmatic? - 17th ISACA South Florida WOW Con...
Early Tech Adoption: Foolish or Pragmatic? - 17th ISACA South Florida WOW Con...Early Tech Adoption: Foolish or Pragmatic? - 17th ISACA South Florida WOW Con...
Early Tech Adoption: Foolish or Pragmatic? - 17th ISACA South Florida WOW Con...
 
21ST CENTURY LITERACY FROM TRADITIONAL TO MODERN
21ST CENTURY LITERACY FROM TRADITIONAL TO MODERN21ST CENTURY LITERACY FROM TRADITIONAL TO MODERN
21ST CENTURY LITERACY FROM TRADITIONAL TO MODERN
 
My sample product research idea for you!
My sample product research idea for you!My sample product research idea for you!
My sample product research idea for you!
 
DNA LIGASE BIOTECHNOLOGY BIOLOGY STUDY OF LIFE
DNA LIGASE BIOTECHNOLOGY BIOLOGY STUDY OF LIFEDNA LIGASE BIOTECHNOLOGY BIOLOGY STUDY OF LIFE
DNA LIGASE BIOTECHNOLOGY BIOLOGY STUDY OF LIFE
 
Avoiding Bad Stats and the Benefits of Playing Trivia with Friends: PancakesC...
Avoiding Bad Stats and the Benefits of Playing Trivia with Friends: PancakesC...Avoiding Bad Stats and the Benefits of Playing Trivia with Friends: PancakesC...
Avoiding Bad Stats and the Benefits of Playing Trivia with Friends: PancakesC...
 
Manual Eurotronic Thermostatic Valve Comry Z-Wave
Manual Eurotronic Thermostatic Valve Comry Z-WaveManual Eurotronic Thermostatic Valve Comry Z-Wave
Manual Eurotronic Thermostatic Valve Comry Z-Wave
 
5 Tech Trend to Notice in ESG Landscape- 47Billion
5 Tech Trend to Notice in ESG Landscape- 47Billion5 Tech Trend to Notice in ESG Landscape- 47Billion
5 Tech Trend to Notice in ESG Landscape- 47Billion
 
AWS reInvent 2023 recaps from Chicago AWS user group
AWS reInvent 2023 recaps from Chicago AWS user groupAWS reInvent 2023 recaps from Chicago AWS user group
AWS reInvent 2023 recaps from Chicago AWS user group
 
Importance of magazines in education ppt
Importance of magazines in education pptImportance of magazines in education ppt
Importance of magazines in education ppt
 

Brownfield Domain Driven Design

  • 1. Brownfield Domain Driven Design Bring your project to the next level without breaking things (nor people)
  • 2. About me @nicolopigna - PHP developer - Team leader / Software engineer at Rocket Labs, Berlin We proudly run Seller Center, the largest Rocket Internet Marketplace solution. Popular clients: Zalando (Europe), Lazada (south Asia), Linio (south America), Global Fashion Group
  • 3. Why “Brownfield”? More challenging and fun than greenfield! Majority of cases. Open knowledge harder to find. Examples start from the assumption of a greenfield. “Greenfield is exciting at first, but taking a brownfield project and giving it new life, well, is just priceless!” Me on Twitter
  • 4. Why Domain Driven Design? ● Non-trivial domain model ● Linguistic boundaries applied to the code ● Design and code reflect the same concepts 1:1 ● Iterative knowledge distillation ● Both tactical and strategic tools
  • 5. No, let’s not CRUDish applications Generic subdomains Yes, we can ● In your core domain ● In heavy business-logic parts of your application ● In strategic supporting domains Where should I apply it? i.e. where you make most of your money. Can we outsource or buy it? Then it’s one of those.
  • 6. Is it difficult? How do we change? Team ● learn new concepts ● mindshift is not immediate ● eradicate CRUD design ● design business first, then data structures Management ● handle the change ● manage adaptation time ● active part of design process Organisation ● involve business experts ● face potential change ● introspect processes
  • 9. BIG BALL OF “MUD”
  • 10. BIG BALL OF “MUD” Hey, at least it works... Don’t know exactly how, but it does!
  • 11. Where to start from? Ok, we need some Repositores, then a Domain/Model directory which will contain AggregateRoots, Entity, ValueObjects, etc. Yes! Oh, don’t forget about Domain Services, the Application layer and a new event system which we’ll definitely need. What about a new structure for controllers and UI? They’re definitely part of our Bounded Context! Let’s reuse our DB connection class, so we also need a Shared Kernel.
  • 14. Context mapping ● Define your core domain, supporting and generic subdomains ● Define the relations between them and with other external systems ● Define behavior at boundaries and grey areas
  • 15. Event storming ➔ Describe your business through events, what/who caused them, what is the “subject” of your events. ➔ Invite the “right people”, brainstorm, discuss, reach a first representation of your business model. Just let it happen.
  • 16. DON’T JUST SKIP IT! Ubiquitous Language The UL is what takes all things (and people) together. - It dramatically lowers communication and cognitive load, providing a common ground, understandable by anyone. - It defines and explains what domain objects are, how they behave and the relations between them. How can you even start coding something that you haven’t defined in terms of concept and behavior!?
  • 18. Yeah! We’re finally writing some code now! Markers and sticky notes were making me feel so uncomfortable... The evil facilitator shouted at me when I said “cronjob” :’( We were always talking about “Product”, but I think I will call this class “Article”. Buhahaha! product.name is varchar(50) or varchar(255)?
  • 19. Where should we start applying DDD from? Are we confident with DDD, SOLID and refactoring strategies? Let’s start with our Core Domain yes Did someone at least read the Blue and Red books? no yes no Let’s start with a Supporting Subdomain Read them...
  • 20. Keep your UI away CONTROLLERS FORMS TEMPLATES YOUR FAVORITE MVC FRAMEWORK Services (Endpoint / Private) Model Repositorie s Commands Events ✗ ✓
  • 21. CQRS? Yes, please! Your database Command “Write” Model ● Expresses your business behavior ● Changes the state of the system ● Doesn’t expose internal state Query ● Shapes information based on representation type ● Never changes the state of the system ● Exposes internal state “Read” Model
  • 22. Haiku of the code duplication CQRS is applied, duplication comes in. Everything is quiet.
  • 23. Change your state through events DoSomethingCommand Service Unit Of Work load($aggregateRootId) AggregateRoot doSomething() AggregateRootAggregateRoot ● Something Done Repository AggregateRootcommit() flushEvents() Events persist($events) EventBus post($events)
  • 24. Event sourcing? Read storage? IT’S A TRAP!
  • 25. Event sourcing? Read storage? 1 - Added architectural complexity Event application Event replaying Snapshots
  • 26. Event sourcing? Read storage? 1 - Added architectural complexity Event application Event replaying Snapshots 2 - Infrastructure and costs Dedicated data storage (forget MySQL!) Remote communication (via message broker, REST interface, etc.)
  • 27. Event sourcing? Read storage? 1 - Added architectural complexity Event application Event replaying Snapshots 2 - Infrastructure and costs Dedicated data storage (forget MySQL!) Remote communication (via message broker, REST interface, etc.) 3 - Eventual consistency Think about consequences Implement resilient behavior Advanced UI techniques
  • 29. Protect your new code! STRICT RULE: Code from the Big Ball of Mud must not leak into the new BCs nor vice-versa. THEN HOW DO THEY INTERACT? BY MAGIC?
  • 32. MEET THE ANTI-CORRUPTION LAYER YOU SHALL NOT PASS!!! At least, not before I can convert you to something meaningful for your destination context...
  • 35. Anti-corruption layer Legacy context Database ACL Bounded Context Adapters Converters Identity Maps place interfaces here I’m here to stay!!!
  • 36. Anti-corruption layer Legacy context Database ACL Adapters Converters Identity Maps I can fly away, now! Bounded Context place interfaces here
  • 37. What happens next? My new shiny BC Our soon-to-be-shrunk BBoM Anti-corruption layer
  • 38. What happens next? My new shiny BC Our shrinking BBoM Anti-corruption layer My second shiny BC
  • 39. What happens next? My new shiny BC Our shrinking BBoM Anti-corruption layer My second shiny BC
  • 40. What happens next? My new shiny BC Our shrinking BBoM Anti-corruption layer My second shiny BC But of course it’s easier now!
  • 41. From distributed Bounded Contexts to μServices μS = lim Bc(nuc)nuc→ 1
  • 42. Thank you for listening! Time for muddy questions!

Editor's Notes

  1. ...which means that transitions should never be painful, cause troubles nor resulting in neverending refactoring sessions.
  2. SC bootstrapped in 3 months, features added one after another, thus resulting now in some problems controlling the codebase and solving bugs.
  3. hands up people working on projects younger than 6 months. now older. from the latter, who thinks that their codebase already need some refactoring / has problems.
  4. what is a supporting subdomain. what is a generic subdomain. why not in crudish apps
  5. stress “don’t start designing from data”. stress on “introspect processes” to introduce the next Matrix slide.
  6. ask
  7. Stress on why CQRS is a “natural” good choice. Explain the differences btw simplified and “full” cqrs architecture