Saturday 5 October 2013

What is "Code Re-factoring" ?

Recently I go through the process of code re-factoring, before going into detail lets have definition of re-factoring, i.e. "It is process of code restructuring without changing its behavior", first question that may arises is that why we need to restructure our code and this will not going to effect the behavior of our system and the answer will be the detail of re-factoring, now lets assume one developer work one module of the system and other work on another and both developers merge their code, so during these steps developers wrote their code consists of classes containing methods and in methods there may be instantiation of objects, so as the other developers do.
1- After merging first scenario (very common one ) can occur i.e. same general chucks of code for doing       identical work but consists of different method names.
2-Un-necessary creation of methods ( call only from one place)
3-Un-necessary creation of variables ( usually we do for debugging purposes)
4-Extra long methods ( un-necessary logic)

You can find different possible combinations from above points after reviewing your code and when you will remove things like these then this process will be called "Code Re-factoring".


No comments:

Post a Comment