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
●
?
How to refactor (complex) legacy code?
●
But… what if it is not really clear what is the current behavior?
●
We do not have tests as safety net before starting to refactor!
Slide 8
Slide 8 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 9
Slide 9 text
No content
Slide 10
Slide 10 text
Gilded Rose refactoring kata
Description of the kata
https://github.com/emilybache/GildedRose-Refactoring-Kata
https://github.com/emilybache/GildedRose-Approval-Kata
https://github.com/islomar/approval-testing
http://approvaltests.com/