Refactoring Using Tools

These patterns are intended to be used by the community so it is the community the best suited for decide their content.

Refactoring Using Tools

Problem: How do you avoid bugs that may be introduced through human error during refactoring?

Context:

You are developing software and you want to make some refactorings before continuing coding. You followed "The First Refactoring Step". You are now ready to refactor your code.

Forces:

Solution:

Use available tools for refactoring. Take advantage of the features that are provided by your development environment.

Resulting Context

"Refactorings are primarily intended to be safe" [1]. As Martin Fowler says "(...) a safe refactoring is one that doesn't break a program" [2], so using tools to carry out refactorings, together with "Refactoring In Very Small Steps" will increase the safety changing a program. The use of tools reduces the human intervention and this will diminish the introduction of bugs during refactoring.

"Tool-assisted refactoring affects testing" [3]. Much less testing has to occur because refactorings are performed automatically, but there will always be refactorings that cannot be automated, so you still need to "Test Every Refactoring" in those situations.

Rationale

Using a tool to carry out refactorings may be very beneficial. "It can make many simple but tedious checks and flag in advance problems that if left unchecked would cause the program to break as a result of refactoring" [2]. With automatic refactoring tools, "(...) we can allow the design to be more fluid because changing it is much less costly" [3].

References

[1] Sue Bushell. Code OF Practice. http://cio.idg.com.au/index.php/id;1688864994;fp;4;fpid;10. Last confirmed: 10/05/2004.

[2] Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Roberts. Refactoring: Improving the Design of Existing Code. Addison - Wesley, 1999.

[3] Don Roberts, John Brant. Refactoring Tools. In "Refactoring: Improving the Design of Existing Code." Addison-Wesley, pp. 328-332. 1999.

Author: SantiagoValdarrama?


See Also:


CategoryRefactoring


EditText of this page (last edited May 12, 2012) or FindPage with title or text search