tackling legacy code november 2015

39
Tackling legacy code Making scary code less scary Tangled Fishing Line - Aristocrats-hat https://flic.kr/p/6qdTC1 CC BY 2.0

Upload: tomas-malmsten

Post on 12-Apr-2017

171 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Tackling Legacy Code November 2015

Tackling legacy codeMaking scary code less scary

Tangled Fishing Line - Aristocrats-hat https://flic.kr/p/6qdTC1 CC BY 2.0

Page 2: Tackling Legacy Code November 2015

Tomas MalmstenSoftware Craftsman @tomasmalmsten

http://www.tomasmalmsten.com [email protected]

Founder of

@oescg

Programmer at

Øresund SoftwareCraftsmanship Group

Page 3: Tackling Legacy Code November 2015

What?

“Any code I didn’t write”

“Any code not covered by test”

“Any code older then n years”

“Any code that is hard to understand”

“Legacy code is all production code which scares you when you have to change it.”

Page 4: Tackling Legacy Code November 2015

“All code required to deliver the business capability of the system ”

Production code?

Page 5: Tackling Legacy Code November 2015

Why?

Fix problems

Introduce new features

Achieve

Page 6: Tackling Legacy Code November 2015

1. What do we want to achieve?

2. Where do we start?

3. What is this code doing anyway?

4. How can I keep safe?

5. Next steps

Page 7: Tackling Legacy Code November 2015

Ambition Level

Achieve

Page 8: Tackling Legacy Code November 2015

Where do we start then?

Page 9: Tackling Legacy Code November 2015

Start where you stand

.

Where do we start?

Leaning - Tom Parkinson - https://flic.kr/p/6esPpL - CC BY 2.0

Page 10: Tackling Legacy Code November 2015

Where do we start?

Page 11: Tackling Legacy Code November 2015

Offender profiling

Where do we start?

Prague Photographic Hotspot - Steven Kay - https://flic.kr/p/9e4vHH - CC BY-SA 2.0

Page 12: Tackling Legacy Code November 2015

Temporal Coupling

Where do we start?

Page 13: Tackling Legacy Code November 2015

What is this code doing anyway?

From IOCCC 2013 winners cable3 - 8086tiny by Adrian Cable

Page 14: Tackling Legacy Code November 2015

Specification tests

Understanding code

Design - Ben Brown - https://flic.kr/p/8aK8Wh - CC BY-SA 2.0

Page 15: Tackling Legacy Code November 2015

From The Cucumber for Java Book by Seb Rose, Matt Wynne, Aslak Hellesøy

Page 16: Tackling Legacy Code November 2015

Tooling

Cucumber

SpecFlow

RSpec

Selenium support

KarmaJS

but basically any BDD tool works

Page 17: Tackling Legacy Code November 2015
Page 18: Tackling Legacy Code November 2015

Conversational Scrutiny

Understanding code

Jennifer Drawing Ideas - Juhan Sonin - https://flic.kr/p/juPL2q - CC BY 2.0

Page 19: Tackling Legacy Code November 2015

Telling the story of the system

Understanding code

Page 20: Tackling Legacy Code November 2015

Understanding code

Page 21: Tackling Legacy Code November 2015

C4 Architecture Diagrams

Context

Container

Component

Class

Understanding code

Page 22: Tackling Legacy Code November 2015

Tangled Fishing Line - Aristocrats-hat https://flic.kr/p/6qdTC1 CC BY 2.0

Page 23: Tackling Legacy Code November 2015

The Golden Master

NeXTSTEP 3.3 Gamma (Golden Master) - Gerben Wierda- https://flic.kr/p/7rF8jj - CC BY-SA 2.0

How to proceed

Page 24: Tackling Legacy Code November 2015

Light the Forest

How to proceed

Page 25: Tackling Legacy Code November 2015

Find the seams

How to proceed

Page 26: Tackling Legacy Code November 2015

Code from: https://github.com/sandromancuso/trip-service-kata

Page 27: Tackling Legacy Code November 2015
Page 28: Tackling Legacy Code November 2015

Break dependencies

How to proceed

Tama Leaver - https://flic.kr/p/dXgorH - CC BY 2.0The Enterprise Dependency - http://thedailywtf.com/articles/The-Enterprise-Dependency

Page 29: Tackling Legacy Code November 2015

Name everything

How to proceed

Page 30: Tackling Legacy Code November 2015

Next steps

Page 31: Tackling Legacy Code November 2015

Find out what the team knows

Domain

Languages

Testing

Automation

Frameworks

Next steps

Page 32: Tackling Legacy Code November 2015

Start small

Small changes

Small tests

Small incremental learning

Next steps

Page 33: Tackling Legacy Code November 2015

Employ continuous learning

Daily standup with a learning focus

Coder dojos

Mob programming

Pair programming

Retrospective

Next steps

Page 34: Tackling Legacy Code November 2015
Page 35: Tackling Legacy Code November 2015

SummaryLegacy code = All production code which scares you when you have to change it.

Why

Ambition level

Where to start

Where you stand

Hotspot Analysis

Temporal Coupling Analysis

Page 36: Tackling Legacy Code November 2015

Summary

How to understand

Specification Tests

Conversational Scrutiny

Telling the story of the system

C4 Architecture Diagrams

Page 37: Tackling Legacy Code November 2015

Summary

How to proceed

Golden Master

Light the Forest

Find the seams

Break dependencies

Name everything

Page 38: Tackling Legacy Code November 2015

Next steps

What does the team know

Start small

Optimise for learning

Page 39: Tackling Legacy Code November 2015

Tomas Malmsten@tomasmalmsten

http://www.tomasmalmsten.com [email protected]

http://www.slideshare.net/TomasMalmsten/tackling-legacy-code-november-2015

Øresund SoftwareCraftsmanship Group

@oescg

http://www.efolder.net