Introduction to Refactoring
The best way to learn refactoring is to look at an example. In this chapter, we’ll explore a sample refactoring scenario using C# and Visual Studio and see firsthand how refactoring can transform the maintainability of code without altering its functionality.
In this chapter, we’re going to cover the following main areas:
- Refactoring a baggage price calculator
- Refactoring in other editors
Along the way, we’ll cover refactorings around introducing locals, constants, and parameters, extracting methods, and removing unreachable/unused code, as well as touching upon the importance of testing in any refactoring endeavor.