SlideShare a Scribd company logo
Legacy Code 
Evolve or 
Rewrite ? 
A retrospective 
Cyrille Martraire - @cyriux -
http://1.bp.blogspot.com/_SOzNIrpkT7M/TIhYjDKKz-I/AAAAAAAABjo/NCPSaVmZn0w/ 
s1600/100_2824.jpg
Passionate 
developer 
PARIS 
Since 1999 
! 
@cyriux
Paris Software 
Craftsmanship Community 
http://www.meetup.com/paris-software-craftsmanship/
TDD 
BDD 
DDD 
Legacy
Legacy Code: Evolve or Rewrite?
LEGACY
Legacy: 
Evolve or rewrite?
Actual Example
Once upon a time…
There was a 
frustrated ambition
We Want:
Large Ambition
Asset Management
Legacy Code: Evolve or Rewrite?
wanna do big things 
stuck with a legacy
So what do we do?
REWRITE
STOP!
We all want to 
rewrite
Legacy Code: Evolve or Rewrite?
hard to release 
regressions
Legacy
Legacy 
No Test 
& Technical Debt too
http://skillsmatter.com/podcast/design-architecture/talk-from-eric-evans
Plenty of Legacy code 
working since 1993 
Redoing = Waste + Risk
Poorly designed code 
Working well 
Never changed 
Is OK
KEEP iT
KEEP GUI, DB, 
APP Server, 
middleware
We Want 
NEW FEATURES! CHANGE 
SOMETHING
Haz Change?
JUST 
DO IT!
QUICK
Did we break 
something?
No Test 
http://martinezglass.com
Takes a lot of time 
No Test 
+ Debug!
Just Do It: 
Not that quick 
Again and again
Could we do better?
EVOLVE
Surround with tests 
FIRST
Surround with tests!
Legacy Code: Evolve or Rewrite?
Testing legacy code is 
hard & slow
Testing is an 
investment
Driver = Cost of 
testing
A matter of velocity
Legacy testing effort 
Vs. 
All new tested code? 
Is it worth it?
1:4 
(Ok, I totally made it up) 
ratio
REDO
Differentiating to 
the business?
The CEO will tell you
Not differentiating?
BUY
&ADAPT 
your 
process
Differentiating!
REWRITE
"What if we also rewrote 
this crappy part?" 
• Why not, but not now 
• Don't get lost redoing 
everything forever
...
JUST 
ENOUGH
You can rewrite 
You cannot 
rewrite all
What to rewrite? 
Where to 
stop?
Legacy Code: Evolve or Rewrite?
What to rewrite? 
Find 
boundaries
Discover the app 
! 
! 
Read the documents 
Interview people 
Use the application 
Read the code 
Fix bugs
Visualize 
[primary flow & support features] 
http://www.fimarkets.com/pagesen/back-middle-front-office.php
Visualize 
[primary flow & support features] 
http://www.fimarkets.com/pagesen/back-middle-front-office.php
Visualize 
[primary flow & support features] 
http://www.fimarkets.com/pagesen/back-middle-front-office.php
http://staff.bath.ac.uk/enssa/LPDev.htm 
Asset 
Inventory
Asset Capture 
Transmission 
Exhaust 
http://martinfowler.com/bliki/AssetCapture.html 
Engine
Asset Capture 
Transmission 
Exhaust 
Focus on one single asset : the engine 
http://martinfowler.com/bliki/AssetCapture.html 
Engine
Main concepts 
[in selling-something business] 
Trading 
Financial 
Instruments
Main concepts 
[in selling-something business] 
Trading 
Financial 
Instruments 
DON’t 
TOUCH 
REWRITE
DOMAIN FTW!
BOUNDARIES 
& STRUCTURE
Agree on maxims 
[communicate the plan] 
• “Only one 
work site at 
a time: 
instruments” 
! 
• “When in 
Rome, do as 
Romans do”
"The code says it all"
Legacy: Fossilized 
Domain Expertise 
•inspiration 
•obfuscated 
http://newspaper.li/fossil/
Rewrite: 
! 
because of CHANGES 
(or it’s a bad idea)
needs
Rewrite: 
! 
must inject NEW knowledge
Rewrite: 
! 
need business ANALYSIS
WHOLE 
TEAM
Like a new 
project from 
scratch!
So how do 
we 
integrate?
STRANGLE
Strangler 
application 
A new module will 
progressively 
strangle the 
former one, for 
one single asset 
only 
http://martinfowler.com/bliki/StranglerApplication.html 
http://www.flickr.com/photos/louisfoecy/4114597043
Feature Toggles 
! 
Progressively 
turn off legacy 
functionalities 
& turn on the 
new ones 
OLD NEW
if(c == category1) 
{legacy.compute(...)} 
else if(c == category2) 
{strangler.compute(...)} 
//...
Grow a 
Bubble 
Context
! 
Listen to domain experts 
High hygiene standards 
Pair-programming 
TDD, BDD, DDD
Invest in domain 
knowledge 
• Bi-weekly 30mn 
training sessions
Dream model must pass 
every scenario 
Given a floating rate bond on EURIBOR 3M 
And a nominal of 15M EUR 
And an issue date of 2011/06/15 
And an end date of 2012/06/14 
And an SEMI_ANNUAL calculation period ! 
When the EURIBOR 3M evolves: 
Bespoke custom 
DREAM MODEL 
| 2011/09/15 | 3.5% | 
| 2012/03/15 | 4.0% | ! 
Then the cash-flows are: 
| 2011/12/13 | 23000 | 
| 2012/06/14 | 25500 |
Anti-corruption 
layer
Adapter
API 
SPI
Easier to integrate by 
construction 
bespoke lib
Old code: Freeze it
Rewrite 
= 
clear boundaries 
+ 
new strangler application 
+ 
minimal integration
Deliver 
Value 
Quickly
Legacy Code: Evolve or Rewrite?
Questions? Did you try 
similar things too? 
Let’s discuss! 
@cyriux
Follow me @cyriux 
! 
Slides: slideshare.net/cyriux 
Blog: cyrille.martraire.com 
! 
In Paris? Join !
Merci

More Related Content

PDF
Living Documentation (NCrafts Paris 2015, DDDx London 2015, BDX.io 2015, Code...
PDF
Refactor your specs! Øredev 2013
PDF
DDD patterns that were not in the book
PDF
Cyrille Martraire: Living Documentation Jumpstart at I T.A.K.E. Unconference ...
PDF
Domain Modeling towards First Principles
PDF
DDD beyond the infamous repository pattern - GeeCon Prague 2018
PDF
Sunny Tech 2019 - Craft Forever
PPTX
How I Learned to Stop Worrying and Love Legacy Code.....
Living Documentation (NCrafts Paris 2015, DDDx London 2015, BDX.io 2015, Code...
Refactor your specs! Øredev 2013
DDD patterns that were not in the book
Cyrille Martraire: Living Documentation Jumpstart at I T.A.K.E. Unconference ...
Domain Modeling towards First Principles
DDD beyond the infamous repository pattern - GeeCon Prague 2018
Sunny Tech 2019 - Craft Forever
How I Learned to Stop Worrying and Love Legacy Code.....

Viewers also liked (20)

PDF
Domain-Driven Design in legacy application
PDF
Bdd for legacy system
PDF
Moving away from legacy code (AgileCymru)
PDF
Moving away from legacy code with BDD
PDF
DDD session BrownBagLunch (FR)
PDF
Why Domain-Driven Design Matters
PDF
Adopting Continuous Delivery: Adjusting your Architecture
PDF
Escaping Dependency Hell
PDF
Working effectively with legacy code
PDF
DDD: Context is King
ODP
Reversed Test Pyramid - Testing and dealing with Legacy Code
PPTX
Agile Tour Pune 2015:Test automation using BDD - Anita Pol and Sachin Salvekar
PDF
20141024 AgileDC 2014 Conf How much testing is enough for software that can c...
PDF
Jvm-bdd-quality-driven
PPTX
DOES14 - Jonny Wooldridge - The Cambridge Satchel Company - 10 Enterprise Tip...
PPT
Introducing bdd elements to unit testing.pptx
KEY
BDD for Rails Legacy Code
PDF
HTTP demystified for web developers
PDF
About "Apache Cassandra"
PDF
Writing the docs
Domain-Driven Design in legacy application
Bdd for legacy system
Moving away from legacy code (AgileCymru)
Moving away from legacy code with BDD
DDD session BrownBagLunch (FR)
Why Domain-Driven Design Matters
Adopting Continuous Delivery: Adjusting your Architecture
Escaping Dependency Hell
Working effectively with legacy code
DDD: Context is King
Reversed Test Pyramid - Testing and dealing with Legacy Code
Agile Tour Pune 2015:Test automation using BDD - Anita Pol and Sachin Salvekar
20141024 AgileDC 2014 Conf How much testing is enough for software that can c...
Jvm-bdd-quality-driven
DOES14 - Jonny Wooldridge - The Cambridge Satchel Company - 10 Enterprise Tip...
Introducing bdd elements to unit testing.pptx
BDD for Rails Legacy Code
HTTP demystified for web developers
About "Apache Cassandra"
Writing the docs
Ad

Similar to Legacy Code: Evolve or Rewrite? (20)

PDF
The bigrewrite
PPTX
The bigrewrite
PPT
Getting Unstuck: Working with Legacy Code and Data
PDF
ERP Systems - The Next Legacy Dinosaur
PDF
Legacy is Good
PPTX
Novelty in Non-Greenfield
PPTX
Delphix and DBmaestro
PPTX
manage databases like codebases
PPTX
Old code doesn't stink - Detroit
PDF
Being effective with legacy projects
PDF
NRB MAINFRAME DAY 03 - Toine Straathof - Legacy compute: modernisation is not...
 
PDF
Help! My Legacy Application is Unmaintainable!
PDF
Towards preventing software from becoming legacy a road map
PDF
So You Just Inherited a $Legacy Application… NomadPHP July 2016
PDF
Reengineering Legacy Software Chris Birchall
PDF
Just In Time Scalability Agile Methods To Support Massive Growth Presentation
PPTX
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
PDF
So You Just Inherited a $Legacy Application...
PPT
Legacy Systems in Software Engineering SE26
PPT
Bse 3105 lecture 5-evolution of legacy systems
The bigrewrite
The bigrewrite
Getting Unstuck: Working with Legacy Code and Data
ERP Systems - The Next Legacy Dinosaur
Legacy is Good
Novelty in Non-Greenfield
Delphix and DBmaestro
manage databases like codebases
Old code doesn't stink - Detroit
Being effective with legacy projects
NRB MAINFRAME DAY 03 - Toine Straathof - Legacy compute: modernisation is not...
 
Help! My Legacy Application is Unmaintainable!
Towards preventing software from becoming legacy a road map
So You Just Inherited a $Legacy Application… NomadPHP July 2016
Reengineering Legacy Software Chris Birchall
Just In Time Scalability Agile Methods To Support Massive Growth Presentation
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
So You Just Inherited a $Legacy Application...
Legacy Systems in Software Engineering SE26
Bse 3105 lecture 5-evolution of legacy systems
Ad

More from Cyrille Martraire (11)

PDF
Domain modeling for Digital Transformations (FlowCon Paris 2019 edition)
PDF
Hexagonal at Scale, with DDD and microservices! - Voxxed Days microservices 2...
PDF
Bounded Context - DDD Europe Foundation Track
PDF
DDD for real
PDF
Les effets inattendus du passage en Features Teams à grande échelle -ScrumDay...
PDF
Refactor your Specs - 2017 Edition
PDF
Interviewing Domain Experts - Heuristics From the Trenches (DDD Europe 2016 M...
PDF
Ur Domain Haz Monoids DDDx NYC 2014
PDF
Ur Domain Haz Monoids
PDF
I T.A.K.E. talk: "When DDD meets FP, good things happen"
PDF
Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expéri...
Domain modeling for Digital Transformations (FlowCon Paris 2019 edition)
Hexagonal at Scale, with DDD and microservices! - Voxxed Days microservices 2...
Bounded Context - DDD Europe Foundation Track
DDD for real
Les effets inattendus du passage en Features Teams à grande échelle -ScrumDay...
Refactor your Specs - 2017 Edition
Interviewing Domain Experts - Heuristics From the Trenches (DDD Europe 2016 M...
Ur Domain Haz Monoids DDDx NYC 2014
Ur Domain Haz Monoids
I T.A.K.E. talk: "When DDD meets FP, good things happen"
Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expéri...

Recently uploaded (20)

PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Odoo POS Development Services by CandidRoot Solutions
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
ai tools demonstartion for schools and inter college
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
Transform Your Business with a Software ERP System
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Digital Strategies for Manufacturing Companies
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
System and Network Administration Chapter 2
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
How Creative Agencies Leverage Project Management Software.pdf
Upgrade and Innovation Strategies for SAP ERP Customers
ISO 45001 Occupational Health and Safety Management System
Odoo Companies in India – Driving Business Transformation.pdf
Odoo POS Development Services by CandidRoot Solutions
Operating system designcfffgfgggggggvggggggggg
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Design an Analysis of Algorithms II-SECS-1021-03
ai tools demonstartion for schools and inter college
Wondershare Filmora 15 Crack With Activation Key [2025
Softaken Excel to vCard Converter Software.pdf
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Transform Your Business with a Software ERP System
Understanding Forklifts - TECH EHS Solution
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Digital Strategies for Manufacturing Companies
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
System and Network Administration Chapter 2
ManageIQ - Sprint 268 Review - Slide Deck

Legacy Code: Evolve or Rewrite?