Highlights of Llewellyn Falco ‘From 0% to Cleanly Refactored 100% tested code’

May 15, 2019

Highlights of Llewellyn Falco - From 0% to Cleanly Refactored 100% tested code

Gives you some legacy code to practice.

The video goes through the Gilded Rose Kata to add the following feature.

"Conjured" items degrade in Quality twice as fast as normal items.

And again with Kent Beck

Make the change easy, and then make the easy change.
Warning: the first part might be hard.
- Kent Beck

The working with old code uses the Arlo’s commit notation

prefix meaning
F Feature
B Bug
t Test only
r Proveable refactor
a Automated
!!! Non-proveable refactor

Assigns risk to the comments F and B and !!! introduce risk, the lower case t, r and a are safe.

Falco is using a tool to support Test-Commit-Revert, where every day is committed if it the tests pass.

TCR tool in Java

Much of the first part of the talk is about documenting through tests the behaviour of the existing method, and using a coverage tool here is very helpful in showing that you have (well) covered all the existing code before you try and change it.

Adding tests to increase coverage before refactoring

It takes about 20 lines of code and 400 tests until 100% coverage is achieved and we can start to do actual work.

That actual work involved 2 main refactorings

After almost a hundred commits, one Feature commit with 2 lines of code were added.

Resources

v0.7.2