3 Minutes From Safety

08 May 2014

In a recent Dojo I touched on a process we use at WDS for refactoring which I wanted to further evangelise

‘3 minutes from safety’ has three main benefits:

  • Prevent wasted time when developing
  • Make refactoring less daunting while promoting performing changes in small iterations
  • Ensuring an engaging programming experience

The concept dictates that refactoring changes should be multiple iterations which take less than 3 minutes. The developer or pair working on refactoring can have a long term goal in mind but their attempts to reach it should be performed in small steps of around 3 minutes. After each small step the appropriate test suite (or subset) is executed and upon success a commit should be made to the version control system of choice.

I’m sure we’ve all been in a situation where a large refactor seems so daunting that it is left for a period when more time is available (and possibly even then neglected). The concept helps to reduce the occurrences of this, as developers feel less daunted by the prospect of making a few quick changes. Even if not completed the changes can be continued or picked up by another developer/pair in future

Many of us have also all been in a position where we have started refactoring with a long term goal in mind. Due to not constantly running tests, sometime (possibly 45 minutes or even days into the development) we face the realisation that there are serious issues in the work undertaken thus far. A painstaking task is then undertaken attempting to roll back to a point before the issue was introduced. I’ve even seen developers with two screens open attempting to reintroduce code line by line avoiding reintroducing the problem. This is very time consuming. Had 3 minute iterations been performed (with successful test executions) you are never 3 minutes from ‘safety’ or a working code base to iterate on

It’s also an entertaining way to develop with constant sense of achievement at an improved codebase (with green builds), while promoting effective pair swapping.

I hope this has been useful. I am happy to discuss this further and receive feedback in the comments below or on social media

Chris Watkins


Me

I hope this helps. Feel free to share and discuss via social media