Refactoring is at the heart of the way we improve code. We make changes to the code for the purpose of making it easier to understand and easier to modify while maintaining the same behaviour.
In spending time refactoring code, I have noticed that there are three steps that we do:
1. Prepare
2. Improve
3. Clean
We are going to look at several refactorings to understand how these steps help us make changes to our code in a controlled way.
In object-oriented languages like Ruby, people often say that “everything is an object”—but first-class functions have become standard for object-oriented languages too. C# has had them and other related features for years, and even Java is in the ga…