Sunday, March 28, 2010

Refactoring of Code

Refactoring is basically a continuous job for a software programmer to improve code quality and maintainability.
Some good software programmer used to do this with / without knowing of it e.g. moving methods to the super class / abstract class, making general function to do more stuff in small code etc. Generally there will not be extra time given for refactoring the code, unless the code is not able to use without doing it. Whenever a new feature or bug arrives refactoring should be done to improve quality,maintainability and extendability of code.

Software developers are often not willing to do refactoring, because some refactoring are simply tedious and also there is no visible external benefit for all the efforts put in.

It is very common that management only emphasis / rewards externally visible code like new feature and enhanced performance etc but very much not interested to code's quality. However after the code reviews if software developers want to spend some time to refactoring the code, there could be some risk of breaking code via refactoring operations e.g. code is not written as per the coding standards etc.

A software developer wants to refactor some poorly written / structured code, their lead or manager would have a different vision altogether on it and its very common that he /she may deny to modify the working / deployed code. These things also can't be ignored. Sometimes developer and management take decision together of refactoring of bad code.