CSC/ECE 517 Fall 2009/wiki1a 9 DS: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
Line 4: Line 4:


   
   
== Definition ==
== Definition ==  


Refactoring[http://en.wikipedia.org/wiki/Code_refactoring] is defined as the technique by which the existing body of the code is restructured by changing the inner structure and preserving its external behavior. More common refactorings that are available can be found here [http://www.refactoring.com/catalog/index.html]. The tools which are used to achieve this purpose are commonly known as Refactoring Tools.  
Refactoring[http://en.wikipedia.org/wiki/Code_refactoring] is defined as the technique by which the existing body of the code is restructured by changing the inner structure and preserving its external behavior. More common refactorings that are available can be found here [http://www.refactoring.com/catalog/index.html]. The tools which are used to achieve this purpose are commonly known as Refactoring Tools.  

Revision as of 14:50, 12 September 2009

REFACTORING TOOLS



Definition

Refactoring[1] is defined as the technique by which the existing body of the code is restructured by changing the inner structure and preserving its external behavior. More common refactorings that are available can be found here [2]. The tools which are used to achieve this purpose are commonly known as Refactoring Tools.

Refactoring tools are provided as Integrated Development Environment (IDE) features currently and are available for all popular programming languages. For instance, the common IDEs that provide the refactoring tools are IBM’s Eclipse, Sun’s Netbeans and IntelliJ’s IDEA. For further information, an academic thesis “Refactoring Tools and Complementary Techniques” focuses on the survey made on the comparison of refactoring tools usage in IDEs.

Below is an example of refactoring "extract method"

Code Before refactoring

public class Refactoringjava {
 public static void main(String args[]){
 int a = 0,b =2,result;
 result = a+b;
 System.out.println("Sum =" + result);
}

Code after Refactoring

public class Refactoringjava {
 public static void main(String args[]){
 int a = 0,b =2,result;
 result = sum(a,b);
 System.out.println("Sum =" + result);
}
static int sum(int x,int y)
{
int sum = x+y;
return(sum);
}

Overview

This deals with the academic underpinnings of refactoring starting from its evolution and the initiatives taken to improve the current generation of refactoring tools.In addition, this discusses the on going research initiatives to enhance the features in refactoring tools. It also throws lights up on various books, academic thesis, conferences and workshops on the topic of refactoring.

Academic Underpinnings

Motivation

The first official thesis on the area of refactoring leads back to 1992 when Bill Opdyke finished his thesis on the topic "Refactoring Object-Oriented Frameworks"[3]. Bill Opdyke was working in Bell Laboratories developing electronic switching systems. When he started to pursue his doctoral studies he wanted it to be related to practical business applications. That is when he narrowed down on this topic which led to the official shaping of the cloud refactoring.

The Basic motivation behind the emergence of refactoring was the software re-usability and cutting down cost involved in restructuring software for various purposes. Thus refactoring leads to software reuse in future.

Though it might appear that refactoring began in research labs it actually emerged on an ad-hoc basis when object-oriented programmers came across situations where they felt the need for change in object oriented software. Refactoring actually has its roots way back. Factoring was a key technique in Forth Language from its birth in 70’s. Absence of appropriate syntax made it not possible to extract the best use out of it. Ralph Johnson was the first person to use the name refactoring in print. Along with Bill Opdyke he published a paper on refactoring in 1990.

Etymology

The first known use of the term “refactoring” appeared in “Refactoring: An Aid in Designing Application Frameworks and Evolving Object-Oriented Systems” by Ralph Johnson and Bill Opdyke in 1990. But Refactoring as a function and as a technique, was almost certainly used before then.

More Works

Lot of work has been done on this area which includes the thesis work “Practical Analysis for refactoring” [4] by Donald Bradley Roberts. It focuses on several ways to make a refactoring tool that is both fast and reliable enough to be useful. In another thesis work “Refactoring as Formal Refinements” [5] by Márcio Cornélio throws light on algebraic technique that presents refactoring as behavior preserving transformation. For list of other thesis works and papers refer to the References section.

Books on Refactoring

Various books are available on the topic of refactoring these days. The initial list of books includes “Refactoring: Improving the Design of Existing Code“ [6] by Martin Flower and Refactoring to Patterns [7] by Joshua Kerievsky and many more books on this topic. For listing of books on refactoring refer to the external links.


Initiatives taken to improve current generation of refactoring tools

Various initiatives like conferences, workshops are conducted by Organizations like Institute of Electrical and Electronics Engineers (IEEE), Associate for Computing Machinery (ACM) to improve the current generation of refactoring tools. The first initiative taken to improve the current generation of refactoring tools was the creation of the refactoring research web portal ([8]). This research web portal includes a collection of links and articles that provide the researchers and industrial engineers an up-to-date knowledge on refactoring.

Workshops and Conferences

The second initiative taken was, organization of workshops which serve as a forum to bring researchers and tool vendors together for collaborative efforts in developing the refactoring tools. This initiative has been taken with the motive to develop the tool support for refactoring efficiently by combining the state-of-the-art research with the challenges from real-time applications. The benefits of such workshops by collaborating the researchers and tool vendors are, to develop the tools in a short period of time and to eliminate the redundant works by other researchers and tool vendors. The workshops on refactoring tools are being conducted annually at various places

The first workshop on refactoring tools was conducted on July 31st 2007 in conjunction with European Conference on Object-Oriented Programming (ECOOP) [9] at Berlin. Various papers like automated refactoring for improved cohesion, reuse based refactoring tools, Engineering reusability for software refactoring tools and others were presented and discussed. The proceedings of the first workshop can be found as a TU Berlin Technical Report, ISSN 1436-9915.

The second workshop on refactoring tools was conducted on October 19th 2008 in conjunction with Object-Oriented Programming Systems, Languages and Applications (OOPSLA) [10] at Nashville, Tennessee. Various papers that were accepted and discussed were Cross Language Refactoring for Eclipse plug-ins, Tool support for refactoring functional programs, Towards a Refactoring guideline using code clone classification and others. More accepted papers at the second workshop can be found at [11]. The interest in research in refactoring tools has increased to a greater extent that more papers were submitted and more researchers and tool vendors like JetBrains, Microsoft participated at the workshop.

The third workshop on refactoring tools is going to be held on October 25-29, 2009 in conjunction with Object-Oriented Programming Systems, Languages and Applications (OOPSLA) [12] at Orlando, Florida. The papers have been invited for the topics which include language-independent transformation frameworks, language-independent analysis frameworks and analytical representations.

Ongoing Research

Refactoring in general preserves the behavior of the program during restructuring. But with the metaphor of extended language, the refactoring can be done in an efficient manner. The extended language implementation technique is all about embedding the source code into the extended language where the refactoring is easier to perform and then translating the refactored code into original language. This has been implemented on the well-known refactoring ‘Extract Method’ which showed the results that overall refactoring can be decomposed into micro-refactorings which are easy to implement and test.

Another improvement in which a tool can provide is the refactoring based on invariant preservation rather on the regular pre-condition based. The program invariants are nothing but the predicates about the objects state and their relationships which remain valid for every execution of program. There are quite a few initiatives that can be taken as part of the future research, which include the structural refactorings ‘Encapsulate Field’ or ‘Move Method’ implementation using the micro-refactoring decomposition approach. The above research is being conducted by the Programming Tools Group at University of Oxford.More information on this research can be found at [13]

Lots of initiatives are being taken by tool vendors to improve refactoring tools. One such case is Net Beans where research is being carried on in this arena. The “replace method code duplicate” feature is being designed to locate selected method code repetitions and turn them in to a method call. The “generify” feature is currently developed for the transformation of non – generic code in to generic aware code. The “copy class” feature is currently in experimental stage to tap the feature of refactoring that allows to copy an existing class or interface. Likewise other features like “Inline method” which is used to inline a method, “Introduce variable” and “Clean up” are currently developed in their labs.

Other Initiatives

Apart from workshops held specifically for refactoring tools, other conferences have been organized by Automated Software Engineering (ASE), International Conference on Software Engineering (ICSE), Foundations of Software Engineering (FSE) wherein papers on refactoring have been presented and awarded the best paper award.

In addition to the workshops and conferences, the weekly contest on refactoring “Refactor It! The Weekly Book Giveaway” has been started by Billy McCafferty to increase the awareness and interest among the software developers, students and other programming communities. Various groups like Software Architecture Group (SAG) at University of Illinois at Urbana-Champaign, Program Analysis and Transformation (PAT) group at IBM TJ Watson Research Center have been organized at Universities and Organizations to conduct research in refactoring tools and to improve the current generation of refactoring tools. More details about various groups and people can be found at [14]

External Links

Refactor It contest [15]

Refactoring tool for .NET [16]


Books

Refactoring Workbook - William.C.Wake [17]

Refactoring to Patterns - [18]

Refactoring Databases : Evolutionary Database Design - [19]

Professional Refactoring in Visual Basic - [20]

CoreJ2EE Patterns - [21]

References

Thesis Works

William F. Opdyke, Refactoring object-oriented frameworks, University of Illinois at Urbana-Champaign, Champaign, IL, 1992 [22]

Refactoring as Formal Refinements- Marico Lopes Cornelio [23]

Practical Analysis for Refactoring – Donald B Roberts, University of Illinois at Urbana-Champaign Champaign, IL, USA[24]

Refactoring Tools and Complementary Techniques - Martin Drozdz, Derrick G Kourie, Bruce W Watson, Andrew Boake Espresso Research Group, Department of Computer Science, University of Pretoria, Pretoria, South Africa 0001 [25]

Other Papers/Conferences

William F. Opdyke and Ralph E. Johnson. Refactoring: An aid in designing application frameworks and evolving object-oriented systems. In Proceedings of Symposium on Object- Oriented Programming Emphasizing Practical Applications (SOOPPA), September 1990.

Refactoring, Reuse & Reality, Bill Opdyke, Lucent Technologies/ Bell Labs, Copyright 1999, Lucent Technologies[26]

Why Don’t People Use Refactoring Tools? Emerson Murphy-Hill and Andrew P. Black, Portland State University [27]

First workshop on refactoring in conjunction with ecoop Berlin 07 [28]

Second ACM Workshop on Refactoring Tools (WRT'08)[29]

Accepted papers for WRT’08 [30]

Third ACM Workshop on Refactoring Tools (WRT'09)[31]

ACM SIGSOFT 2006 / FSE 14[32]

29th Int. Conference on Software Engineering® 20 - 26 May 2007[33]

21st IEEE/ACM International Conference on Automated Software Engineering[34]

Web

Refactoring Info[35]

www.refactoring.com [36]

Refactoring at AllExperts [37]

Refactoring Tool - NetBeans [38]