54
RESCUING LEGACY SOFTWARE FROM IMPENDING DOOM martin.cronje@myob. com @martincron je jacques@nreality. com @jacdevo s

Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Embed Size (px)

Citation preview

Page 1: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

RESCUING LEGACY SOFTWAREFROM IMPENDING DOOM

[email protected]@martincronje

[email protected]@jacdevos

Page 2: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Why this talk?

Page 3: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Legacy code kills agility

Page 4: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Refactoring is hard

Page 5: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Refactoring storiesfrom the

trenches

Page 6: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Why and when, but not how

Page 7: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Credits• Kent Beck on Small, Safe Steps and TDD• Robert C. Martin on Clean Code• Martin Fowler on Refactoring Techniques• Ward Cunningham on Technical Debt• Michael Feathers on Starting with a Mess• J.B. Rainsberger relating it to Accidental

Complication

Page 8: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

What is legacy code?

What is the value in fixing legacy code?

How do we speak to Product Owners about it?

Should you rewrite?

What is refactoring?

When should we refactor?

Page 9: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

What is legacy code?

Page 10: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Legacy code has a negative perception.

Page 11: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

• Any code in production• Ancient code• Unsupported technology• Not up to standard• Code smells

You may have heard…

Page 12: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

- J.B. Rainsberger

code that we feel afraid to

Legacy code is valuablechange.

Page 13: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Summary: Legacy Code?Legacy code is risky and expensive to change

Page 14: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Why fix legacy code?

Page 15: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

• If it ain't broken, don't fix it• Make it easier to work with• For our future happiness• Good craftsmanship

You may have heard…

Page 16: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Professionalism

Page 17: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Quality culture

Page 18: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Return on investment

Page 19: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Increasing the future value

Page 20: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

…a trade-off against present value

Page 21: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

In summaryImprove the code to reduce maintenance costs

Page 22: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Do POs understand the value in fixing legacy code?

Page 23: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

• Not enough time• We cannot afford it• Business will close-down• Just one more feature• They allow us to recover

You may have heard…

Page 24: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Developers vs ProductOwners

Page 25: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Do they really say that?

Page 26: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

How do we explain it to them?

Page 27: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Risk to business continuity

Page 28: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Unpredictable timelines

Page 29: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

In summaryLearn how to communicate the impact of legacy code to Product Owners

Page 30: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Should we rewrite?

Page 31: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

• No. Rather the devil you know• No. It’s too expensive• Yes. Use latest technologies• Yes. Learnt from mistakes!

You may have heard…

Page 32: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Big bang rewrite

Page 33: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Lesson #1:Unpredictable timelines

Page 34: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Lesson #2:Puts your business at risk

Page 35: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Lesson #3:Always harder than you

think

Page 36: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

In summaryResist the temptation to rewrite.

Page 37: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

What is the alternative?

Page 38: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Refactoring is a safer bet

Page 39: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

- Refactoring, Martin Fowler

and cheaper to modify without

…make it easier to understand

behavior.

changing its observable

Page 40: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Increase ease of change, while decreasing risk of

change

Page 41: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Small incremental improvements into

production

Page 42: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Cast safety nets as you progress

Page 43: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Start with lowest impactimprovemen

t

Page 44: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

In summaryImprove design without changing observable behaviour

Page 45: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

When do we refactor?

Page 46: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Construction Refactoring

Page 47: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

New code Code changes Solution wide

TDD Refactoring Litter-Pickup RefactoringComprehension Refactoring

Preparatory Refactoring

Planned RefactoringLong-Term Refactoring

Refactoring workflows

Page 48: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Cleaning up as we go

Page 49: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Shanty Towncampsite?

What if this is the

Page 50: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

problems

Handling major

Page 51: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

refactoring

Tracer bullet

Page 52: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

In summaryClean up as you go, and escalate when there is an impending crisis

Page 53: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

Code that we’re afraid to change.

Invest in making change easier and less risky.

Talk to Product Owners about return on investment.

Avoid rewrites, favour refactoring.

Many, small improvements without changing behaviour.

Keep it clean and escalate when crisis is imminent.

Page 54: Agile Australia 2016 - Rescuing Legacy Software from Impending Doom

HOW ARE YOU GOINGTO MAKE IT HAPPEN?

[email protected]@martincronje

[email protected]@jacdevos