A Day of Refactoring

Kevlin Henney

⏱ 1-day-workshop
09:00-18:00, Tuesday, 16th April 2024
For many people, refactoring is a simple code transformation they click on in a context menu or via a keyboard shortcut. They can extract, inline, replace, move, rename, etc. at will. The widespread availability of automated refactoring in many languages should have made oversized classes and long-winded functions a thing of the past. But it hasn't. Having a tool is only part of the solution: knowing what to do with it and how to use it well is what makes the bigger difference.

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!


  • 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
🏷 refactoring
🏷 design
🏷 unit testing
🏷 programming paradigms
🏷 Gilded Rose

Kevlin Henney

Kevlin is an independent consultant, trainer, speaker and writer. His development interests lie at the intersection of programming, practice and people. He has been a columnist for various magazines and web sites, a contributor to open- and closed-source software and a member of more committees than is probably healthy (it has been said that "a committee is a cul-de-sac down which ideas are lured and then quietly strangled"). He is co-author of two volumes in the Pattern-Oriented Software Architecture series, editor of 97 Things Every Programmer Should Know and co-editor of 97 Things Every Java Programmer Should Know.