tackling legacy code november 2015
TRANSCRIPT
![Page 1: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/1.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/2.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/3.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/4.jpg)
“All code required to deliver the business capability of the system ”
Production code?
![Page 5: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/5.jpg)
Why?
Fix problems
Introduce new features
Achieve
![Page 6: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/6.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/7.jpg)
Ambition Level
Achieve
![Page 8: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/8.jpg)
Where do we start then?
![Page 9: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/9.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/10.jpg)
Where do we start?
![Page 11: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/11.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/12.jpg)
Temporal Coupling
Where do we start?
![Page 13: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/13.jpg)
What is this code doing anyway?
From IOCCC 2013 winners cable3 - 8086tiny by Adrian Cable
![Page 14: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/14.jpg)
Specification tests
Understanding code
Design - Ben Brown - https://flic.kr/p/8aK8Wh - CC BY-SA 2.0
![Page 15: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/15.jpg)
From The Cucumber for Java Book by Seb Rose, Matt Wynne, Aslak Hellesøy
![Page 16: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/16.jpg)
Tooling
Cucumber
SpecFlow
RSpec
Selenium support
KarmaJS
but basically any BDD tool works
![Page 17: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/17.jpg)
![Page 18: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/18.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/19.jpg)
Telling the story of the system
Understanding code
![Page 20: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/20.jpg)
Understanding code
![Page 21: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/21.jpg)
C4 Architecture Diagrams
Context
Container
Component
Class
Understanding code
![Page 23: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/23.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/24.jpg)
Light the Forest
How to proceed
![Page 25: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/25.jpg)
Find the seams
How to proceed
![Page 26: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/26.jpg)
Code from: https://github.com/sandromancuso/trip-service-kata
![Page 27: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/27.jpg)
![Page 28: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/28.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/29.jpg)
Name everything
How to proceed
![Page 30: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/30.jpg)
Next steps
![Page 31: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/31.jpg)
Find out what the team knows
Domain
Languages
Testing
Automation
Frameworks
Next steps
![Page 32: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/32.jpg)
Start small
Small changes
Small tests
Small incremental learning
Next steps
![Page 33: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/33.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/34.jpg)
![Page 35: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/35.jpg)
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](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/36.jpg)
Summary
How to understand
Specification Tests
Conversational Scrutiny
Telling the story of the system
C4 Architecture Diagrams
![Page 37: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/37.jpg)
Summary
How to proceed
Golden Master
Light the Forest
Find the seams
Break dependencies
Name everything
![Page 38: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/38.jpg)
Next steps
What does the team know
Start small
Optimise for learning
![Page 39: Tackling Legacy Code November 2015](https://reader035.vdocument.in/reader035/viewer/2022062503/58ed501b1a28abbc448b45cf/html5/thumbnails/39.jpg)
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