Slide 1

Slide 1 text

What is Legacy Code ? Definition

Slide 2

Slide 2 text

A code you want to change that no one understands but still provides value. Definition

Slide 3

Slide 3 text

A code without predictability Definition

Slide 4

Slide 4 text

A code without predictability Definition Developers have no idea how long a change can take 01.

Slide 5

Slide 5 text

A code without predictability Definition Developers have no idea how long a change can take 01. 02. There is no correlation between the business and the technical complexity

Slide 6

Slide 6 text

A code without predictability Definition Developers have no idea how long a change can take 01. 02. There is no correlation between the business and the technical complexity 03. You don’t know when something will break

Slide 7

Slide 7 text

A code with no test Definition

Slide 8

Slide 8 text

A code with no test Definition « Most of the fear involved in making changes to large code bases is fear of introducing subtle bugs; fear of changing things inadvertently. Without test, you just don’t know whether things are getting better or worse. » — Michael Feathers

Slide 9

Slide 9 text

Hello, I work in the finance industry at Lgo.group. My name is Arnaud LEMAIRE, And my twitter handle is @lilobase Who am I?

Slide 10

Slide 10 text

This talk is focused on strategic considerations and not tactical ones Disclaimer

Slide 11

Slide 11 text

A natural process Why does it appear?

Slide 12

Slide 12 text

A natural process Why does it appear? Add lines of code

Slide 13

Slide 13 text

A natural process Why does it appear? Add lines of code More complexity

Slide 14

Slide 14 text

A natural process Why does it appear? Add lines of code More complexity Increase in software entropy

Slide 15

Slide 15 text

A natural process Why does it appear? Add lines of code More complexity Increase in software entropy Legacy Code

Slide 16

Slide 16 text

You need to let your software die* A natural process that cannot be stopped

Slide 17

Slide 17 text

You need to let your software die* * part of your software 01. A natural process that cannot be stopped

Slide 18

Slide 18 text

You need to let your software die* * part of your software 01. 02. Without bringing the remaining parts with it A natural process that cannot be stopped

Slide 19

Slide 19 text

You need to let your software die* * part of your software 01. 02. Without bringing the remaining parts with it 03. Optimize your software for replacement A natural process that cannot be stopped

Slide 20

Slide 20 text

But that can be slowed down A natural process that cannot be stopped

Slide 21

Slide 21 text

Strategies at the code level Legacy Code

Slide 22

Slide 22 text

Would you rather go to the dentist twice a year or brush your teeth every day? When to refactor

Slide 23

Slide 23 text

When to refactor Always leave the campground cleaner than you found it.

Slide 24

Slide 24 text

Always leave the campground cleaner than you found it. When to refactor This is the « boy scout rule » 01.

Slide 25

Slide 25 text

Always leave the campground cleaner than you found it. When to refactor This is the « boy scout rule » 01. Developing a new feature and refactoring doesn’t mix well! 02.

Slide 26

Slide 26 text

Always leave the campground cleaner than you found it. When to refactor This is the « boy scout rule » 01. 03. When you found a bug, first write a test that triggers it, then fix it. Developing a new feature and refactoring doesn’t mix well! 02.

Slide 27

Slide 27 text

Stop the weekly technical debt repayment session When to refactor

Slide 28

Slide 28 text

Stop the weekly technical debt repayment session When to refactor The « We’ll fix it later » syndrome 01.

Slide 29

Slide 29 text

Stop the weekly technical debt repayment session When to refactor The « We’ll fix it later » syndrome 01. 02. The same cause always produces the same effect

Slide 30

Slide 30 text

Stop the weekly technical debt repayment session When to refactor The « We’ll fix it later » syndrome 01. 02. The same cause always produces the same effect Instead provide a learning time, so you stop writing legacy code 03.

Slide 31

Slide 31 text

Avoid the big bang refactoring

Slide 32

Slide 32 text

The mikado™ method How to refactor

Slide 33

Slide 33 text

The mikado™ method How to refactor Undo when an experiment fail

Slide 34

Slide 34 text

The Hotspot™ method How to refactor

Slide 35

Slide 35 text

The Hotspot™ method How to refactor

Slide 36

Slide 36 text

The Hotspot™ method How to refactor

Slide 37

Slide 37 text

The Hotspot™ method How to refactor

Slide 38

Slide 38 text

Strategies at the system level Legacy system

Slide 39

Slide 39 text

Refactoring ? How to tackle it?

Slide 40

Slide 40 text

Refactoring ? How to tackle it?

Slide 41

Slide 41 text

Refactoring ? How to tackle it?

Slide 42

Slide 42 text

Rewrite ? How to tackle it?

Slide 43

Slide 43 text

Rewrite ? How to tackle it?

Slide 44

Slide 44 text

Ask your business to help you map your (business) domain 01. Invoice Generation Invoicing Car rental

Slide 45

Slide 45 text

Starting from your existing system Don’t start from your existing system

Slide 46

Slide 46 text

Ask them to tag where there is room for improvement. 02. Invoice Generation Invoicing Car rental

Slide 47

Slide 47 text

Select a tagged support service with few dependencies 03. Invoice Generation Invoicing

Slide 48

Slide 48 text

Starting with your core business Don’t start by your core business Invoice Generation Invoicing Car rental

Slide 49

Slide 49 text

Starting with your core business Don’t start by your core business Invoice Generation Invoicing Car rental !

Slide 50

Slide 50 text

Starting with your core business Don’t start by your core business Invoice Generation Invoicing Car rental !

Slide 51

Slide 51 text

Don’t do horizontal slicing ! Don’t do horizontal slicing UI Persistence Service !

Slide 52

Slide 52 text

Don’t do horizontal slicing ! UI Persistence Service Don’t do horizontal slicing

Slide 53

Slide 53 text

Rewrite it… 04. Invoice Generation Invoicing New invoice Generation

Slide 54

Slide 54 text

And put an anti-corruption layer to prevent legacy leakage 05. Invoicing New invoice Generation Legacy API Legacy Database New Api ACL

Slide 55

Slide 55 text

Invoicing New invoice Generation Legacy DB Event bus

Slide 56

Slide 56 text

Invoicing New invoice Generation Legacy DB Event bus Hidden dependencies

Slide 57

Slide 57 text

Invoicing New invoice Generation Legacy DB Event bus

Slide 58

Slide 58 text

Replace the old legacy system 06. Invoicing Invoice Generation New invoice Generation

Slide 59

Slide 59 text

Replace the old legacy system 06. Invoicing New invoice Generation

Slide 60

Slide 60 text

Repeat 07. Invoice Generation Invoicing Car rental

Slide 61

Slide 61 text

Until you can reach the core 08. Invoice Generation Invoicing Car rental

Slide 62

Slide 62 text

The Ship of Theseus strategy also known as the Strangler pattern How to tackle it?

Slide 63

Slide 63 text

The Ship of Theseus strategy also known as the Strangler pattern How to tackle it? You’ll need to coordinate your actions at the system level 01.

Slide 64

Slide 64 text

The Ship of Theseus strategy also known as the Strangler pattern How to tackle it? You’ll need to coordinate your actions at the system level 01. 02. Beware of functional debt

Slide 65

Slide 65 text

The Ship of Theseus strategy also known as the Strangler pattern How to tackle it? You’ll need to coordinate your actions at the system level 01. 02. Beware of functional debt 03. Optimise your new system for replacement!

Slide 66

Slide 66 text

• The Mikado method (Ellnestam & Brolund) • Software Design X-Rays (Thornhill) • Working Effectively with Legacy Code (Feather) • Refactoring (Fowler) Going further Thanks to Michael C. Feather, Adam Thornhill, Cyrille Martraire, Thomas Pierrain, Martin Fowler, Jean-Baptiste Dusseaut, Ola Ellnestam, Daniel Brolund, Adrian Bolboaca

Slide 67

Slide 67 text

Thank you! I work in the finance industry at Lgo.group. My name is Arnaud LEMAIRE, And my twitter handle is @lilobase