ITWissen.info - Tech know how online

Refactoring

Refactoring refers to the revision of the structure of a piece of software without changing its external behavior. Frequently in this connection also the term restructuring is used, within object-oriented programming( OOP) one speaks however rather of Refactoring. A meaningful approach for Refactoring results with completion of the software in an error-free condition. The cause of refactoring is the adaptation of used software to new changed requirements, which leads to the degeneration of existing structures in a software.

The goal of Refactoring is it to structure the program code more clearly and more clearly, in order to minimize in particular the expenditures for its maintenance and care. The Refactoring has particularly with the Extreme Programming an essential position. Modern, integrated development environments such as the EclipseIDE, Visual Studio or Borland Delphi provide automated functions for refactoring.

With the technique of refactoring, modifications can be made to the program code without affecting its function. This applies to object-oriented software however not to their additions such as the aspect or subject-oriented programming. By the Refactoring thus an existing software becomes generally or also in parts more readable, more understandable in its structures, better modifiable, better testable and redundancies are avoided.

Typical for Refactorings are the following examples:

  • Renaming of variables and methods.
  • Encapsulation of fields.
  • Introducing a new abstract superclass.
  • Removing and reordering parameters.
  • Reformatting of program code.
  • Extraction of methods, classes, packages and interfaces.
  • Improvement of data encapsulation.

If it concerns the Refactoring of program code in Java, then the link mentioned below to the list of possible Refactorings published originally by Martin Fowler is an interesting assistance. The hints given there can also be applied to other object-oriented languages.

Refactoring and Extreme Programming

Particularly in connection with Extreme Programming Refactoring comes a substantial role, since there the development follows in incremental steps. The procedure of the Extreme Programming contains the constant change at existing program code and the addition of new code snippets. There the constant restructuring - the Refactoring - of the program code is a condition for a successful software project.

Mainly with more complex software projects the overview of the program code can be only limited possible, so that already in itself trivial modifications such as the renaming of a variable or a method can lead to more complex error situations. In such cases, it makes sense to use modern software tools such as Eclipse, Visual Studio or Borland Delphi, which provide a range of automated functions for refactoring - controlled by convenient menus. But even when such a tool is used, refactoring is always a process in many, smaller steps, and the individual steps must always be followed by a detailed test.

Informations:
Englisch: Refactoring
Updated at: 09.11.2013
#Words: 444
Links: software (SW), connection, object (O), occupant out of position (OOP), error
Translations: DE
Sharing:    

All rights reserved DATACOM Buchverlag GmbH © 2024