Refactoring: Improving the Design of Existing Code (2nd Edition) Cover Book cover copyright Martin Fowler

Overview

This chapter works through refactoring a piece of JavaScript code. It outlines both a process (working on a private branch and committing after each successful refactoring) and a series of refactoring methods.

My One Takeaway

This concept of working on a private branch and then making small commits that are later squashed down into a larger significant commits interests me. Firstly, it makes me wonder how hard it would be to swap so quickly between code and commit because I usually only commit once something large has been done. Secondly, it makes me wonder if this could just be as simple as git commit -a -m "Refactoring" or if more thought needs to be put into the commit messages. I wish this part had been shown as well (maybe the 3rd Edition can cover that :-)).

Random Thought

For those of you who are following along, when he references a refactoring method it always has the a number in parenthesis after the name. This is the page where the method is explained. Took me way longer to figure this out than I would have liked. :-)