In this chapter, we will take a look at source code refactoring in IntelliJ IDEA. Refactoring is the process of restructuring your source code base without changing its behavior. It enhances code readability and reduces its complexity. When the internal code structure improves, the code becomes easier to maintain and extend. Refactoring is important not only during everyday work on your own code, but for legacy code as well. The refactoring patterns are catalogued by Martin Fowler at www.refactoring.com. This is a great resource—the catalogue contains a detailed description of each refactoring along with the corresponding code example. We will focus on how IntelliJ IDEA helps with executing these refactoring actions.
We will cover the following topics in this chapter:
An overview of refactoring
The most important refactoring actions
A summary of refactoring shortcuts
With every new release, IntelliJ IDEA contains additional refactoring actions, so the arsenal...