Code samples for the opening chapter of Refactoring


From time to time people ask me for a copy of the code I used in the
opening chapter of Refactoring, so
they can follow along themselves. I had Reasons for not providing this code,
specifically laziness. Fortunately Emily Bache is more dedicated, and she
has set up a github repository – the Theatrical
Players Refactoring Kata
– with the code, and enough tests to make it
reasonable to do the refactoring.

The repository goes further than this, however, in that it includes similar
sample code in a dozen languages, including C, Java, Rust, and Python.

She has recently posted a video to her YouTube
channel
, which outlines why she encourages folks to use this code while
they are reading that chapter. Her channel includes a lot of videos on good
code technique, and she has a Patreon for readers to support
her work.