Refactoring might present itself as a dreaded beast, with hundreds of raging heads, eager to devour developers. At the same time, it also can be a fulfilling experience. And an opportunity to better know your application, its architecture and idiosyncrasies. The code base grows and rots, software gains technical debt, dirty fixes and quick hacks. After some time, there might be no easy, or quick, way of adding features and changing behavior. This article sheds light on the refactoring process and its concepts.
“The fundamental problem with program maintenance is that fixing a defect has a substantial (20-50 percent) chance of introducing another. So, the whole process is two steps forward and one step back.”
– Frederick P. Brooks, Jr. (The Mythical Man-Month)
What is Refactoring
Refactoring is the process of clarifying and simplifying the design of existing code, without changing its behavior. We can categorize them by goal and size: code refactoring and architecture refactoring. Code Refactoring aims to increase the quality of the code. It contains small tasks chained together, or not. Architecture Refactoring is the bigger counterpart. It reorganizes the existing code into new logical layers and represents deeper changes. It is usually done by changing the software architecture/infrastructure. Continue reading What is Refactoring?