Why do we REFACTOR

Its not going to be easy for the client. Its not going to be easy for the developers. Its not going to be easy for the company…… there comes a day when most of the code base (in my experience more that 60% of projects I had worked with), needs a REFACTOR time.

Am a very big fan of Martin Fowler ( www.martinfowler.com) and following him for more than a decade now. He has an interesting website too on refactoring — www.refactoring.com. This website talks a lot about refactoring and defines refactoring as “is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior.”

Am not going to discuss the commonly agreed reasons for refactoring here. If the development team is wrong and if the product owner is not clear enough with road map then obviously “Refactor” phase will hit much earlier than we anticipate.

Many by default thinks Refactoring is another word for cleaning up code, but its not only that. Refactor defines one of the techniques for improving the health of a code-base. We use the word “restructuring” as a more loosely tied up general term for reorganizing code, but that may incorporate other techniques also in the process.

One of the interesting point to mention is that, when we work along with start-ups or product idea owners we will plan/anticipate the refactor phase much earlier too. In idea validation phase or when client has budget challenges we suggest MVP (Minimum Viable Product) phase. In MVP we built the product real quick and help the client test the market, demo to investors within short span (may be 8–12 weeks) etc. Once the business viability is proved, we help client to make the product scalable with more features. So even before we start the phase, MVP code has to be refactored completely to adapt the changes of next phase. When we took this route, its a great success for most of our clients.

Other interesting instance is where the challenge be more, we call those projects as “Rescue Projects”. Due to various, non listable, long reasons the project owner ends up in need of a rescue team. Trust me, Rescue is more tougher than developing some thing new. We would have easily developed all the required functionalities of the product from scratch, but rescuing the same functionalities be so huge challenge. When we say so, its mostly refactoring the code and improving the architecture. Some time we end up doing a new development on rather to refactor too.

Be the next phase after MVP or a rescue project or a GREEN project, Refactor phase is really an essential phase. Personally, I don’t see Refactor be the result only because of insufficient upfront design or architecture mistake or code debut or code sucks or wastage of resource. Mostly its a self evaluation phase of the team, where they can really work to make things better than otherwise. Only one factor I want to stick to be that Refactoring needs to be well supported by a Test Suite, which should cover at-least 90% of code base and functional scenarios.

To conclude: Its good to have “Refactor” phase planned & efforts included for all the projects. Review & Refactor will help the product development a lot.

Willing to listen to you all, share your thoughts in comments pls.

Originally published at https://www.linkedin.com on April 6, 2015.

Would love to hear your comments and experience on this topic…

Contact Me: Are you or your company looking for a talented, innovative & hand-on expert development/design team who is good in communication & conceptualisation to help build + scale your web & mobile app? Email me personally (and directly) at ganapathi@agiratech.com for a free consultation!

I’d love to help you.

About Author: The author is Ganapathi M, CEO, Agira Technologies (#agiratech). With a track record of around 14 years in the arena of technology, Gana has an astounding passion for technology and is an enthusiastic entrepreneur. Being a people’s person and a natural leader, he has built a strong and dedicated team of technology experts at Agira (#agiratech).

About Company: Agira (#agiratech) is into software solutions that address the needs of the changing industry. With Agira’s expertise and customer oriented services in areas such as Web, Mobile, Cloud, Open Source Frameworks, Consulting and Future Technologies, Agira help the clients to make their vision/dream come to true existence. www.agiratech.com will throw more light on its services and credentials. #agiratech