MSc-IT Study Material
January 2011 Edition

Computer Science Department, University of Cape Town
| MIT Notes Home | Edition Home |

Refactoring

Refactoring is the activity of changing the software's internal structure without changing its external behaviour. It is specifically concerned with improving the software's internal structure.

Refactoring provides higher quality software, and eases the work of the software engineer. During refactoring, the software is examined for:

As with all of the design concepts we have discussed, refactoring should be done to make code easier to understand, easier to develop and test, and easier to change. A good indication that you need to refactor a particular software application is when it has become difficult to either add new functionality to it, or to fix a bug in it.

Note

Refactoring is not concerned with fixing bugs or adding functionality: it is concerned with improving design concepts in the software. This, however, should make it easier to find and fix software bugs. Importantly, refactoring does not include changing the running time of an application: as with bug fixing or adding functionality, a change to the running time is clearly changing the software's behaviour, and so not in the purview of refactoring.