A Day of Refactoring
Kevlin Henney
Refactoring is a first-class design approach, not simply a clean-up practice. Although refactoring applies to code that has suffered technical neglect, it also applies to code that is of good quality. As we develop software, we learn more about what is required and how we might choose to organise our thinking and, therefore, our code. Refactoring lets us take advantage of new knowledge not just to pay back technical debt, but also to repartition and reconceptualise code by simplifying it, changing its paradigm or moving it towards a design that better handles trends in requirements.
In this workshop, we'll revisit what refactoring is (and isn't), examine what practical and social obstacles refactoring faces, and put into practice the idea that refactoring should be considered a design process.
For the hands-on part of this workshop, exercises will be done in C++. You can choose to do to the hands-on work on your own, in pairs or in ensembles of three or four. You will need a laptop, but you won't need any specific tooling installed: all the refactoring exercises will use the online cyber-dojo environment. So, bring a laptop and your questions, and be prepared to have a good day with good discussion!
Outline
- Introduction
- Legacy code
- Refactoring concepts
- Hands-on exercise (procedural code refactoring with existing tests)
- Review and discussion
- Declarative thinking and changing paradigms
- Hands-on exercise (larger procedural code refactoring with existing tests)
- Review and discussion
- Tests, testing workflow and refactoring-oriented software engineering
- Fallacies and realities of code coverage
- Main hands-on session (Gilded Rose, test writing and refactoring)
- Review and discussion
- Outroduction