Tackling Legacy Code November 2015

Post on 12-Apr-2017

173 views 0 download

Transcript of 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

Tomas MalmstenSoftware Craftsman @tomasmalmsten

http://www.tomasmalmsten.com public@tomasmalmsten.com

Founder of

@oescg

Programmer at

Øresund SoftwareCraftsmanship Group

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.”

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

Production code?

Why?

Fix problems

Introduce new features

Achieve

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

Ambition Level

Achieve

Where do we start then?

Start where you stand

.

Where do we start?

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

Where do we start?

Offender profiling

Where do we start?

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

Temporal Coupling

Where do we start?

What is this code doing anyway?

From IOCCC 2013 winners cable3 - 8086tiny by Adrian Cable

Specification tests

Understanding code

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

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

Tooling

Cucumber

SpecFlow

RSpec

Selenium support

KarmaJS

but basically any BDD tool works

Conversational Scrutiny

Understanding code

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

Telling the story of the system

Understanding code

Understanding code

C4 Architecture Diagrams

Context

Container

Component

Class

Understanding code

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

The Golden Master

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

How to proceed

Light the Forest

How to proceed

Find the seams

How to proceed

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

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

Name everything

How to proceed

Next steps

Find out what the team knows

Domain

Languages

Testing

Automation

Frameworks

Next steps

Start small

Small changes

Small tests

Small incremental learning

Next steps

Employ continuous learning

Daily standup with a learning focus

Coder dojos

Mob programming

Pair programming

Retrospective

Next steps

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

Summary

How to understand

Specification Tests

Conversational Scrutiny

Telling the story of the system

C4 Architecture Diagrams

Summary

How to proceed

Golden Master

Light the Forest

Find the seams

Break dependencies

Name everything

Next steps

What does the team know

Start small

Optimise for learning

Tomas Malmsten@tomasmalmsten

http://www.tomasmalmsten.com public@tomasmalmsten.com

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

Øresund SoftwareCraftsmanship Group

@oescg

http://www.efolder.net