I followed a link to an example of refactoring and thought it was a really good example. Shows the basics of refactoring:
- Name things so that they make sense
- Extract to named methods to make things easy to read
- Remove levels of indentation
- Write tests to prove the success/continued functionality of the app
- Continue extracting
I really like that Mathias Verraes explains his thinking while he refactors the method, and the Q&A that follows.