Bugs introduced during refactoring:
Refactoring is an activity that you want to avoid but can’t. In-order to maintain the quality of products and to ensure the functionality is up-to-date. Refactoring is a painful pill that must be swallowed.
In almost all the refactoring activities, there is a huge probability of introducing bugs in an already functional feature. I have actually observed a pattern during refactoring activities: :
“The number of bugs introduced during the refactoring activity are directly proportional to how enthusiastic is the programmer who is performing refactoring”
I have seen programmers go to un-necessary lengths during the refactoring process and end up introducing intricate and hard to find bugs. [they forget to KISS]
Solution: never perform refactoring unless the code’s test coverage is 100% . Spend some time and write some unit test cases before initiating the refactoring activity.