Personal tools
You are here: Home Projects Nate Refactoring
Document Actions

Refactoring

What is refactoring?

Refactoring is the process of gradually improving the design of an existing software system by performing source code transformations that improve its quality in such a way that it becomes easier to maintain the system and reuse parts of it, while preserving the behaviour of the original system. A programmer can perform refactoring manually, or with the assistance of automated tools.

Extracting reusable functions

In the past, slicing was suggested to be used in the extraction of reusable functions. The idea is that if a piece of code computes more than one result, and we are interested only in the code that computes one of those results, slicing can help identify the relevant code contributing to the computation of that result. That code can be extracted into a separate program entity and can then be freely reused. The original code should then be retrofitted to invoke the extracted code.

Slice extraction

The Nate project formalises this notion of extracting reusable functions (or methods) as a refactoring technique and implement a tool to support its use. The Extract Slice refactoring can be used to extract a slice either from a single method, from the whole analysed program, or from a user-selected subset of the program. The slice is extracted into a new method (or several methods) and is replaced with method calls (invoking the extracted code). In cases where the slice cannot be extracted without modifying the program's behaviour, the refactoring is rejected (unless the user chooses to proceed regardless). Details can be found here.

Links

Back to Nate's home page


Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: