There are a lot of farms in the Netherlands, and a lot of cows. All cows on a farm have a certain value, based on their history. Cows are sold and bought, being born and slaughtered, inseminated or milked, generating a large stream of information. Information which is used by the farmers but also by the government. Taxes, carbon footprints, CO2 reductions, business value, it all needs up-to-date and accurate animal information.
Due to new laws, some serious changes had to be implemented on a legacy system. Nightly processing of new information was already problematic, extending the business rules would even make it slower. Scaling and extending the legacy application, which heavily leaned on stored procedures and triggers, appeared to be too difficult. While Domain Driven Design could really help to bring clarity in this complex domain, rebuilding was not an option.
Time to introduce the Bubble Context of which Eric Evans wrote in his paper “Getting Started With DDD When Surrounded By Legacy systems”! In this session I will use a simplified version of the legacy system and demonstrate how to create your own bubble context to apply new business rules while keeping the existing system intact. In fact, we hardly touch the existing system! I will explain the advantages and disadvantages of a bubble context and how to move even further away from the legacy system.
Living In Your Own Bubble: From Legacy to Domain Driven Design
1. LIVING IN YOUR OWN BUBBLE
FROM LEGACY TO DOMAIN DRIVEN DESIGN
Jacob Duijzer - DDD Foundations - June 7, 2023
2. ABOUT ME
Jacob Duijzer, Vught, the Netherlands.
Helping developers, teams & organizations build better software.
Agile Coach | Enabling Team Lead | Consultant | Speaker @
Follow me:
Team Rockstars IT
https://linkedin.com/in/jacobduijzer
20. THE BUBBLE CONTEXT
A 'bubble' is a small bounded context established using an Anticorruption
Layer (ACL) for the purpose of a particular development effort and not
intended necessarily to be expanded or used for a long time.
Eric Evans - Getting Started With DDD When Surrounded by Legacy Systems
21.
22.
23. THE ANIMAL BUBBLE CONTEXT
Replacing existing software (database functions, triggers)
Using the Strangler Fig pattern
Introducing a queue
Enabling fast, on-demand, per animal processing
24. LIVING IN THE BUBBLE
Disclaimer: this is not a real application, just a less complex recreation!
25. GOALS
What does the Anti Corruption Layer look like?
The data flow inside the bubble
Handling the different events
Implementing the last event handler, the Departure * Arrival event
28. KEY TAKEAWAYS
Working with legacy code can be very cool!
The Bubble Context can give your applications a second life (or at least extend its life)
Using different bubbles can help autonomous teams, create value stream teams (Team Topologies)
Using a ubiquitous language is really important (even when that means using Dutch in your source code!)
Specifications by Example, reusable, automated, "business readable" specifications is very powerful
31. SOURCES
Images from Unsplash:
Getting Started with DDD When Surrounded By Legacy Systems - Eric Evans
Living In Your Own Bubble - GitHub Repository
Anoek Folkertsma
Jo-Anne McArthur
Ryan Song
Rajesh Ram
Lomig
William Isted
Rubén Bagüés