Refactoring is one of the best practices of Extreme programming . Even the most stable project requires occasional modification. The idea is to clean up duplication and smelly code. The principle of software entropy suggests that program starts off in a well-designed state, but as new bits of functionality are tacked on, programs gradually lose their structure. We write a small program that does a specific job well. Later we add new functionality on top of existing program, often in a way that the existing program was not intended to support. In such cases, we can either do a complete redesign or patch some work around. Redesign and rewriting existing code results in extra work, which in most cases we can’t afford. Also, we may miss existing functionality or introduce new bugs. The principle usually followed is: “If it ain’t broke, don’t fix it!”. However, if a code is made complex due to poor design choices and unnecessary constructs then it starts emanating code smell. ...