Refactoring is the Yoga for Software
Yoga is an ancient practice originated in India. It brings health and well-being to the human body.
We can metaphorically compare Yoga with Refactoring. Yoga is to body as Refactoring is to software. As Yoga brings health and well-being to human body, Refactoring improves the health of a software system by removing the “toxins” and “smells”.
Yoga offers various asanas (or postures, such as Padmasana and Vajrasana) where each asana flexes muscles belonging to a certain part of the body and bring benefits to the part of the body. Different postures not only aim different types of benefits to the different part of the body but also they work at different dimensions of human well-being (such as physical strength, flexibility, mental and spiritual piece). Similarly, refactoring techniques (such as extract method, rename, and extract class) can be compared with Yoga postures. As different Yoga postures bring benefits to different parts of the body, each refactoring technique targets the software at different abstraction levels and improves the quality of the software.
Motivation and dedication play an important role while performing Yoga as well as Refactoring. It is often difficult to engage individuals with the practice of Yoga/Refactoring especially when they have not really understood and realize the benefits. On the other hand, mere execution is not enough; half-hearted execution cannot bring the desired effects.
Both Yoga and Refactoring require training; it is mandatory to perform them accurately. Performing them in an incorrect way may bring harm (rather than any good) to the body and to the software.
Yoga leads to rising and expansion of spiritual consciousness.Similarly, Refactoring is an activity to increase the design and architecture consciousness (being aware of design and architectural challenges, constraints and proposing appropriate balancing solutions).
The effects of Yoga, as well as Refactoring, are not visible immediately. For the sustained benefits, it is required to practice Yoga (Refactoring) regularly.