Ego slide
Hemos venido a jugar...
Desarrollador de software/producto
@islomar
islomar@gmail.com
Teleco, Antropología Social y
Cultural, Executive MBA, CSM…
Slide 3
Slide 3 text
What is legacy code for you?
Slide 4
Slide 4 text
For some people, legacy code is about...
●
Code not developed by me
●
Code that you don't know
●
Code without tests
●
Code difficult to maintain (difficult to understand or change)
●
Code no longer supported
●
Code that you would prefer not to touch
●
?
Slide 5
Slide 5 text
What is technical debt for you?
Slide 6
Slide 6 text
Is technical debt always "bad"?
Slide 7
Slide 7 text
Debt metaphor by Ward Cunningham (1992)
“Shipping first time code is like going into debt. A little debt
speeds development so long as it is paid back promptly with a
rewrite.
[...] The danger occurs when the debt is not repaid.”
Slide 8
Slide 8 text
About technical debt
●
The extra effort that it takes to keep on working on the code
is the interest paid on the debt.
●
It slows you down in baby steps, not realizing and taking for
granted that “it is the way it is”.
●
OK in isolated and stable areas which are “never” touched.
How to refactor (complex) legacy code?
●
We do not have tests as safety net before starting to refactor!
●
But… what if it is not really clear what is the current behavior?
Slide 11
Slide 11 text
Approval testing to the rescue!!
It also exists something called Golden Master
"Approval testing is a test technique which compares the current output of your code
with an "approved" version. The approved version is created by initially examining the
test output and approving the result."
Assume the current behaviour is correct: the first goal is to refactor in a safe way!!
Slide 12
Slide 12 text
No content
Slide 13
Slide 13 text
Live Coding time!!
https://github.com/islomar/approval-testing
Slide 14
Slide 14 text
Resources: kata and approval testing
● Kata
○ Description of the kata
○ https://github.com/emilybache/GildedRose-Refactoring-Kata
○ https://github.com/emilybache/GildedRose-Approval-Kata
○ http://coding-is-like-cooking.info/2013/03/writing-good-tests-for-the-gilded
-rose-kata/
● Approval testing
○ https://www.infoq.com/news/2017/02/approval-testing-texttest
○ http://approvaltests.com/
Slide 15
Slide 15 text
Resources: screencasts and books
● Screencasts
○ Refactoring legacy code with approval testing (Emily Bache)
○ Approval tests with Lift Kata (Emily Bache)
○ Testing and refactoring legacy code (Sandro Mancuso)
○ Approval tests with Java
● Emily Bache
○ https://www.praqma.com/stories/all/#emilybache
○ https://github.com/emilybache
○ How to develop new features with approval testing
Slide 16
Slide 16 text
Resources: refactoring and technical debt
●
Original writing about technical debt from Ward Cunningham
○
The Debt Metaphor (video)
●
Tech Debt - MPJ's Musings - Fun Fun Function
● https://martinfowler.com/bliki/TechnicalDebt.html
● https://martinfowler.com/bliki/TechnicalDebtQuadrant.html
● https://www.fluentcpp.com/2020/01/17/technical-debt-is-like-a-tetris-game/
● https://martinfowler.com/bliki/DesignPayoffLine.html
● https://martinfowler.com/bliki/DesignStaminaHypothesis.html
● https://martinfowler.com/articles/workflowsOfRefactoring/
● https://www.praqma.com/stories/advanced-testing-refactoring-techniques/