RefaX: A Refactoring Framework Based on XML Nabor C. Mendonça1, Paulo Henrique M. Maia2, Leonardo A. Fonseca1, Rossana M. C. Andrade2 1

Mestrado em Informática Aplicada Universidade de Fortaleza Av. Washington Soares, 1321 Fortaleza, CE, Brazil {nabor, leonardo}@unifor.br Abstract

Refactoring, i.e., the process of changing a software system to improve its internal quality and preserving its external behavior, is gaining increasing acceptance among software developers. Even though many refactoring tools are now available for a variety of programming languages, most of them are difficult to reuse, extend or even customize, mainly because they provide no uniform way of representing and manipulating source code information. This paper presents a refactoring framework, called RefaX, which relies on open, XML-based source code models and processing standards to facilitate the development, customization and reuse of refactoring tools. In particular, RefaX makes it possible to develop refactoring tools that are independent of source code model, programming language and XML processing technology. The viability of the framework is illustrated through a refactoring prototype for Java.

1. Introduction The costs and complexity of software maintenance are widely recognized. It is estimated that 50% of a software engineer’s time is dedicated to browsing and comprehending existing code [17], and that in the last three decades maintenance activities took over 60% of all software development costs in most organizations [20]. Several techniques, such as program analysis, reverse engineering, reengineering, and metrics, together with their respective support tools, have been proposed as an attempt to reduce the complexity and high costs that are typical to software maintenance. One technique, refactoring, i.e., the process of changing a software system to improve its internal quality while preserving its

2

Departamento de Computação Universidade Federal do Ceará Campus do Pici, Bloco 910 Fortaleza, CE, Brazil {pauloh,rossana}@lia.ufc.br external behavior [8], in special, is gaining increasing acceptance among software developers. The refactoring main goal is to reduce code complexity, which increases rapidly as the code evolves, by improving its internal quality, making it more extensible, modular, reusable and maintainable [18]. The adoption of refactoring has been boosted by the fact that it is one the pillars of Extreme Programming [3], an emerging and increasingly popular software development methodology, and by increasing dissemination of the refactorings catalog created by Fowler [8]. The best way to apply refactoring to code is by means of automated tools. This avoids the risk of manual intervention and minimizes the amount of tests needed every time the code is changed. A considerable number of refactoring tools are now available for a variety of programming languages, including, for example, C# Refactoring [4], for C#, Refactoring Browser [22], for Smalltalk, and JFactor [12], for Java. Nonetheless, it is virtually impossible to find a tool, or a set of tools, that fully satisfy the needs of its users. The main reason is that some or all of the refactorings provided by a tool may not be adequate for its users, sometimes forcing them to use more than one tool for different applications. In addition, most of the available tools are difficult to customize, offer a limited number of refactorings, and provide no easy way for a user to adapt or extend an existing refactoring, or create a new one. The need for tools that implement refactoring in a more consistent, generic, scalable and flexible way has already been recognized in [18]. One of the main factors that hinder customization in current refactoring tools is the lack of a standard data model to represent their target language, since most tools use their own internal representation. To address this issue, an increasing number of data models are being proposed as candidates for a standard source code representation, within the context of different

programming languages and paradigms. Nearly all models proposed thus far share the fact that they rely on XML [28] as the standardization mechanism. These include language-specific models, such as CppML [15] and JavaML [16], and more general models, such as GXL [10]. The main advantage of representing source code information in XML is that tool developers could benefit from the abundance of technologies currently available for manipulating XML data, be it for browsing [27][21], querying [27][28], storage [30] [7][24]or transformation [29][33], among other purposes. Even though some maintenance-oriented tools are already benefiting from XML as a way to extract and exchange source code information (for example, [19][6]), they do not yet fully explore the potential of XML and its related technologies in terms of better customization, extension and reuse. In particular, we are unaware of any refactoring or reengineering tool that relies on XML as its underlying transformation mechanism. In an attempt to fill this gap, this paper presents an open, XML-based refactoring framework, called RefaX, whose main goal is to facilitate the development of more flexible refactoring tools. Through the use of advanced XML processing standards and object-oriented technology, RefaX offers refactoring tools developers with three important independence dimensions: independence of source code model, independence of the target programming language, and independence of code manipulation technologies. This means that a RefaX refactoring might be more easily reusable across different XML-based source models for different target programming languages, and applied to the code using different XML processing tools. This degree of flexibility may be of great benefit not only to tools developers, who will have a powerful environment upon which to build, extend and reuse refactoring operations, but also to refactoring users, whose tools will be more easily adaptable to their specific maintenance needs. The rest of the paper is organized as follows. Section 2 and 3 give an overview of existing XML processing standards and XML-based source code models, respectively. Section 4 introduces our adaptation of the general refactoring process. Section 5 describes the framework in more details, including its requirements, architecture, and an example of use. Section 6 reports on the implementation of RefaX4J, a reusable refactoring prototype for Java. Section 7 covers related work. Finally, section 8 concludes the paper and gives our directions for future work.

2. XML processing technologies

standards

and

In this section we give a brief overview of existing XML processing standard and their supporting

technologies, discussing their suitability (or lack thereof) as a means to implement refactoring operations. The standards are grouped into two categories: query languages and update and transformation languages.

2.1. Query languages The two main languages for querying XML data, both being W3C standards, are XPath [27] and XQuery [28]. Xpath is a simple query language to access parts of an XML document through path expressions. In addition to allow the description of paths over the XML tree, XPath also provides primitives for manipulating strings, numbers, and logical expressions. XPath is most commonly used as part of other more sophisticated technologies, such as XSLT [29], or as an API for extracting or filtering out parts of an XML document for later processing. Its greatest strength – simplicity – is also its main drawback, as the path expression mechanism lacks support for more advanced queries, such as nested, conditional and recursive queries. XQuery is an extension of XPath. Thus, it also supports the concept of path expressions to access parts of the XML tree. However, unlike XPath, XQuery supports query expressions based on the clauses FOR, LET, WHERE, ORDER BY and RETURN (the so called FLOWR – or “flower” – clauses). These clauses bring extra power and flexibility to the language, as they allow the specification of multiple nested expressions in the same query. Other advanced features added by XQuery include several built-in operators for processing query results, such as sort, count and average; support for conditional queries through the logical operators IF/THEN/ELSE; and support for recursive queries through user-defined functions, which is XQuery’s mechanism for query encapsulation and abstraction. This latter feature is of particular interest for the development of refactoring operations, since many source code models and relationships are recursive in nature.

2.2. Update and transformation languages Currently, there is no standard way of updating XML data. In an attempt to fill this gap, several XML update languages have been proposed and co-exist as potential W3C standards. These include XQuery Update [14], the work of Tatarinovi et al. [25], and XUpdate [33]. Both XQuery Update, which is a direct extension of XQuery, and the language proposed by Tatarinovi et al. have limitations in terms of tool support and syntax expressibility, which have generally compromised their usability. XUpdate, on the other hand, is a compact language with a much wider user base. Initially developed within the context of the XML:DB project [33], XUpdate

1

Original Source Code

/ Code2XML 2

3

XML Query Engine

- Pre-conditions - Post-conditions -Ref. Operations

XML Data Repository Modified Source Code

#

Refactorings

4 XML2Code

XML Update Engine

Figure 1: A refactoring process based on XML. is now supported by an increasing number of XML databases and processing tools. XML transformation languages, such as XSLT [29], offer another possibility of updating XML data, as they can be applied to transform the original XML document into a new document that reflects the desired changes. Although some types of refactorings could be implemented this way, such an approach would be highly ineffective when only a small fraction of the code is actually affected by the refactoring – which is likely to be the case for most refactorings used in practice. In addition, refactorings expressed as document transformations tend to be more cumbersome than an equivalent specification in, for example, XUpdate.

3. XML-based source code models As mentioned previously, there has been a number of proposals for using XML as a common data model to represent source code information. In [15], Mamas and Kontogiannis propose three of such models: JavaML, CppML and OOML. JavaML and CppML are used to represent source code written in Java and C++, respectively, in the form of an Abstract Syntax Tree (AST). OOML generalizes the two former models, preserving only those syntactic elements that are shared by both. Badros proposes another XML model for Java, also called JavaML [1]. Just like the previous models, this model also represents source code information as an AST. Compared to Mamas and Kontogiannis’s JavaML, though, Badros’s model captures the same information in a richer yet more concise way. More recent examples of XML models proposed for Java are BeaultyJ [2] and MultiJava [5]. GXL [10] is another source code model based on XML, where the code structure is captured in the form of directed graphs. This model was originally proposed as a common exchange format to promote interoperability

among software maintenance and reverse engineering tools. Another format, which aims at representing the whole source code in XML, without loss of information, is srcML [14]. Unlike the previous formats, srcML does not capture the code’s AST, but rather “annotates” the code with structural information represented as XML tags, thus preserving all types of non-syntactic information, such as blanks, comments and indentation marks. The advantage is that adding the structural information does not require a complete parsing of the code, which simplifies the development of XML conversion (or “annotation”) tools. On the other hand, the resulting srcML document will contain a lot of non-essential information for many refactoring operations, which may hinder their implementation in this particular format. It is worth noting that, from a strictly syntactic point of view, there are significant differences among all those models, with some models being more complete and/or concise than others. Syntactic differences may be an important (but not the only) criterion to be considered when choosing an XML code data model to be used as a basis for refactoring (for example, availability of a proper model extractor may also play an important role). Nonetheless, different XML data models may suit different developers under different circumstances. Therefore, the choice of the best model should be left to the developer, and in no way be restricted by the refactoring framework.

4. A refactoring process based on XML A typical refactoring process, as generally supported by most existing refactoring tools, follows five main steps [18]: 1. Detecting where to apply refactorings in the code. 2. Determining which refactorings should be applied to the each chosen location.

3.

Guaranteeing that the chosen refactorings preserve behavior. 4. Applying the refactorings. 5. Verifying that program behavior is in fact preserved after the refactorings have been applied. Our work focuses on steps 3 through 5 of this general process. We assume that the user is responsible for steps 1 and 2, either working manually or with the help of automated solutions, such as metrics and reverse engineering tools. The above three steps were further refined to accommodate the suit of XML models and technologies necessary to our work. The resulting process was reorganized into four new steps, as shown in Figure 1. They are: Conversion. The process first step consists of converting the original source code files selected by the user into the corresponding representation in XML. We refer to the tool responsible for this step as the converter. Storage. The source code information of interest, now represented as XML data, should be stored in some form of repository, so that it can be effectively accessed in later steps. This repository can range from simple flat files to a fully-fledged commercial XML database. Refactoring. In this step, the user selects which refactorings she wishes to apply to the code locations selected in the Conversion step. The refactoring step is further decomposed into three activities: test of preconditions, applying refactoring operations, and checking behavior preservation. Test of pre-conditions. Pre-conditions are responsible for guaranteeing the refactoring operation legitimacy. A given refactoring can have multiple pre-conditions. In the case that at least one of them is not satisfied, the refactoring will not be applied. The pre-condition concept was introduced by Opdyke [19] and later extended by Roberts [22]. Roberts defined pre-conditions as combinations of Analysis Functions (AFs), which describe relationships among source code entities (classes, methods, fields, etc). AFs can be grouped into two categories: primitive AFs and derived AFs. As an example, consider the following primitive AFs: IsClass(className), which checks whether className already exists as a class in the code, and Superclass(className), which returns the superclass of className, if such class exists. A derived AF can be specified in terms of one or more primitive AFs. For example, the derived AF AllSuperclasses(className) returns the set of all superclasses of className, and can take one of the following values: • Ø, when Superclass(className) = Ø; or • Superclass(className) U

AllSuperclasses(Superclass(className)), otherwise. AFs only access source code information, without actually changing it. Thus, they can be expressed in any XML query language for which there is an XML query engine available. Applying refactoring operations. Once all preconditions have been validated, the next activity consists of applying the refactorings. A single refactoring may have multiple refactoring operations. Since each of these operations has the effect of changing the code, they are expressed using an XML update or transformation language. Checking behavior preservation. After each refactoring operation is executed, it is necessary to verify that the modified code still preserves its external behavior. To this end, Roberts introduced the concept of post-conditions, which are conditions that must be valid after all refactoring operations of a refactoring have been applied. Those conditions vary according to the type and purpose of each refactoring. Since they only access source code information, post-conditions are also implemented as AFs. Reversion. Once all code changes are done at the XML data repository, they need to be reflected back to the original code artifacts. We refer to this second conversion step, from XML back to code, as reversion, and to the conversion tool used to do the reversion as reverter. In the following we describe how this process is supported by the RefaX framework.

5. RefaX: A refactoring framework based on XML In this section we discuss the requirements for the RefaX framework and present its main architectural elements. We also illustrate its use through an example.

5.1. Requirements The design of RefaX was largely influenced by the requirements of FAMIX [26], a meta-model for representing object-oriented software entities and their relationships in a language-independent way. In RefaX we also considered requirements specific to XML, such as scheme- and technology-independence. These and other requirements are discussed below: • Scheme-independence. RefaX was designed to support different data models (or schema) for the same target language. This means that refactoring operations written for a particular language (say Java) using a given data model (say MultiJava) may be easily reused to a different data models of the same language (say JavaML and BuiltyJ).

RefaX Core

RefaX Tool

Refactorings

RefaX Facade Conversion Manager

RefaX Core

Reversion Manager

XML Data Manager

Analysis Functions

Refactoring Operations

Code Access Functions

Figure 2: RefaX architecture. • Language-independence. RefaX also supports the specification of reactorings in varying levels of abstraction. This makes it easier for the developer to design refactoring operations abstract enough to be applicable to different programming languages. This requirement is particularly important in practice, since languages that follow the same paradigm usually have many types of source code entities in common, and thus may offer a number of opportunities for refactorings reuse. In general, the greater the differences between two or more programming languages, the higher the level of abstraction necessary for writing common refactorings to them. • Technology-independence. RefaX was designed with several hot spots, so that a developer can easily decouple refactorings implementation from the suit of XML processing technology (converter, storage medium, update engine, etc) necessary to execute them. This frees the developer from committing to any specific technology early in the development process, and also makes it easier to replace one of more of the chosen technologies for new ones in later stages. • Realiability. Through the use of pre- and postconditions, RefaX refactorings are guaranteed to preserve the external behavior of the code – insofar as those conditions have been properly defined! This means that developers should design new refactorings with great care, especially their pre- and post-conditions components. • Scalability. Ideally, RefaX refactorings should be effectively applicable to systems of varying sizes, from a few lines of code to millions of lines of code. In practice, the performance of any RefaX-based tool will be largely dependent on the scalability of its underlying XML processing technologies. Therefore, the fact that RefaX is designed in a technology-independent way plays an important role towards the development of more scalable refactoring tools.

Other important requirements, such as easy of customization and extension, are intrinsic to the framework’s object-oriented design.

5.2. Architecture At the implementation level, RefaX consists of a Java API that provides developers with the necessary classes to build flexible refactoring tools, i.e., refactoring tools that meet most of the requirements discussed above. We chose Java, among other reasons, due to its platformindependence nature and, more importantly, to the fact that nearly all XML processing technologies currently available offer a Java API as a built-in feature. At the architectural level, RefaX is organized in a hierarchy of multiple layers, as shown in Figure 2. The first layer, RefaX Tool, contains code that is specific to each refactoring tool. This is where developer can extends the framework’s basic services. The second layer, RefaX Facade, as the name says, implements the Facade design pattern [9]. It offers a unified interface for the suit of services implemented in the layer below. Those services are Conversion Manager, which abstracts from the conversion technology; RefaX Core, which encompasses a number of other services for applying refactoring operations and verifying pre- and post-conditions; and Reversion Manager, which abstracts from the reversion technology. Finally, the last layer, XML Data Manager, abstracts from the XML processing technologies, including the storage medium and query and update engines. All three “manager” layers implement one or more instance of the Factory Method design pattern [9]. The RefaX Core services are the heart of the framework, as they implement some of its most important requirements, namely, scheme-independence, languageindependence, and reliability. Scheme-independence is obtained by encapsulating all functions that access source code information directly in scheme-specific XQuery functions called Code Access Functions (CAFs). To give an example, consider the following CAFs:

getClass($doc), which returns all XML nodes that correspond to class definitions in the XML document $doc, and getClassName($class), which returns the name of the class represented by the XML node $class. Because they embody knowledge on how class definitions are represented in XML, any implementation of getClass or getClassName has to be bound to a specific source code model. On the other hand, the caller of those functions will be completely ignorant to (and hence isolated from) that knowledge, thus improving their reusability. To add support for a new language source model in RefaX, a developer needs to define all the relevant CAFs for the new model’s respective XML scheme. The set of all CAFs for a given source code model constitute a layer upon which different sets of languageindependent AFs can be specified. The framework supports the definition of new AFs as a composition of CAFs and also other analysis functions. This feature implements the notion of primitive and derived analysis functions, as proposed by Roberts [22]. Developers are free to adapt or extend those language-independent AFs, to better suit their tools to the specifics of a particular language. Since AFs only access source code information, though at a higher level of abstraction than CAFs, they are also implemented in XQuery. Finally, all refactoring operations are schemedependent, as they access and change the code structure directly. In the current version of RefaX refactoring operations are implemented as XUpdate expressions.

5.3. An example: implementing the AddClass refactoring Currently, RefaX supports most of the languageindependent refactorings described in [26]. To give an example of how those refactorings are implemented in the framework, let us consider the refactoring AddClass(className, packageName, superclasses, subclasses), which inserts a new class className, without X

Y

any method or attribute, inside the package packageName, with the given class sets superclasses and subclasses as the respective superclasses and subclasses of the new class. Figure 3 illustrates this refactoring. To be applicable, this refactoring depends on the following pre-conditions: • className must be a valid name (i.e., there must not exist another class with the same name in the given package); • all classes in subclasses must be proper subclasses of all classes in superclasses in the original class hierarchy. These pre-conditions are expressed using the analysis functions IsClass, SuperClass and AllSuperclasses, whose implementation in XQuery are shown Figure 4. From their implementation we can see that these functions call three code access functions, namely getClass, getClassName and getSuperClassName, whose implementation should be provided according to the source code model (XML scheme) at hand. The refactoring itself is implemented through the following refactoring operations: • create a new empty class named className; • insert the new class into the package packageName; • set the superclasses of the new class to the classes contained in superclasses; • set the superclasses of each class contained in subclasses to the new class. Each refactoring operation is represented by a Java class containing the necessary XUpdate expressions to modify the relevant documents. This decision increases the number of refactoring operations that have to be implemented, but has the benefit of improving their reusability. In the case of AddClass, the refactoring operations are represented by the classes createNewClass, insertClassIntoPackage, setUpSuperclass, and updateSuperclassOfClass. To verify that those refactoring operations really X

Y

N

Z

W (a)

Z

W (b)

Figure 3: Example of a class hierarchy before (a) and after (b) applying the AddClass (N, “”, [X,Y], [Z]) refactoring.

declare function IsClass ($doc as element(), $className as xs:string) as xs:boolean { for $c in getClass($doc) return getClassName($c) = $className }; declare function Superclass ($doc as element(), $className as xs:string) as xs:string { for $c in getClass($doc) where getClassName($c) = $className return getSuperclassName($c) }; declare function AllSuperclasses ($doc as element(), $className as xs:string) as xs:string { let $d := $doc return if (Superclass($d, $className) = string("")) then string("") else Superclass($d, $className) };

Figure 4: XQuery implementation for the analysis functions used in the AddClass refactoring. preserve the external behavior of the program, we need the following post-conditions: • there is a class named className; • this class has all the classes in superclasses as its superclasses and all the classes in subclasses as its subclasses; • all classes in subclasses inherit from the new class and no longer from the classes in superclasses. As with the pre-conditions, these post-conditions are also implemented using analysis functions. Specifically, we use the IsClass, Superclasses and Subclasses analysis functions, where the latter returns the immediate subclasses of a given class.

6. RefaX4J: A refactoring prototype for Java To demonstrate the viability of the RefaX framework, we conducted a case study where we used RefaX to implement a refactoring prototype for the Java language, called RefaX4J. In addition, to investigate the level of reusability offered by the framework, we developed two versions of RefaX4J: one applicable to the JavaML source code model, as proposed by Badros [1], which we call Badros's version, and the other applicable to the

JavaML source code model, as proposed by Mamas and Kontogiannis [16], which we call M&K's version. We define a version as the set of all XML standards and technologies used to build a single RefaX instance. With these two versions, we intend to illustrate, in a more concrete way, how the framework satisfies the requirements discussed in section 5.1, particularly scheme-independence and technology-independence. We choose those two Java source code models because both have converters and reverters freely available. The framework hot spots for each version of RefaX4J were implemented with the following technologies: • Code access functions: the code access functions were implemented according to the XML schema used in each JavaML model; • Converter: for the Badros's versions we used Jikes, an adaptation of IBM’s Java compiler made by Badros himself, while for the M&K's version we used RET4J [21], a toolset for analysis and transformation of Java programs; • Query engine: IPSI-XQ [11] was used for both versions, as it supports the latest XQuery working draft; • Refactoring specification language: XUpdate [33]was used for both versions, as it is a “real” update language (not a transformation language) and makes it easy to specify queries; • XML data repository: XIndice [32], a freelyavailable native XML database, was used for both versions, as it supports the latest XUpdate specification; • Update engine: we used the update engine embedded in the XIndice both cases; • Reverter: for Badros's version, we used XSLT transformations provided by Badros himself, while for M&K's version we again used RET4J. Table 1 shows the XQuery implementation of the set of code access functions used in AddClass refactoring for each of the two JavaML versions. It should be noted that those functions only return references to XML nodes or strings, which in turn can be manipulated by higher-level analysis functions without concern about their internal structure. Refactoring operations themselves do not use any analysis function, as they are expressed in a different language that is not supported by the XQuery engine. In RefaX4J, they are implemented in XUpdate, whose update engine is embedded in the XML database system, XIndice. Figure 5 shows the XUpdate implementation of the refactoring operation CreateNewClass in both versions of RefaX4J. An example of the result of applying this operation to a Java code fragment, represented in Badros’s JavaML, is given in Figure 6.

7. Related work

Table 1: Examples of code access functions and their XQuery implementation for the two JavaML source code representations. Code access function getClass($doc) getClassName($class) getSuperclass($class) getSuperclassName ($sup) getAttribute($class) getAttributeName($attribute)

JavaML (Badros) $doc//class $class/@name $class/superclass $sup/@name $class//field $attribute/@name

NewClassName public 3 0 3 0

JavaML (M&K) $doc//ClassDeclaration $class/UnModifiedClassDeclaration/@Identifier $class/UnModifiedClassDeclaration/Name $sup/@Identifier $class//FieldDeclaration $attribute/VariableDeclarator/VariableDeclaratorId/@ Identifier

False False True False NewClassName

Figure 5: XUpdate implementation of the CreateNewClass refactoring operation for the two versions of JavaML: Badros (left) and M&K (right). There is a considerable body of work available to support software maintenance in general, and refactoring in particular [18], using a variety of technologies and for a variety of domains. Here we focus on two recent works that are more closely related to ours. In [16], Mamas and Kontogiannis describe an integrated software maintenance environment, called ISME, in which developers can create new maintenance tools integrating existing CASE tools. That environment can be seen as an extra abstraction layer between the

source code and the maintenance tools. Although we share some of their goals and techniques, i.e., better customization and reuse of maintenance tools through the use of XML-based source code models, their work differ from ours in that ISME tools do not use XML to manipulate source code information directly, but only as a means of exchanging that information among its constituent tools. Consequently, unlike RefaX, ISME provides no support for XML-based manipulation of

package client; import clientFunctions; public class NewClassName { } public class Client { private String name; public String getName() { return name; } }

Figure 6: A Java code example (top) and its JavaML/Badros representation (bottom), as modified by the CreateNewClass refactoring operation. The added code is highlighted.

source code data, and, therefore, fails to explore the whole potential offered by XML technologies. In [26], Tichelaar et al describe a source code metamodel, called FAMIX, which provides a basis to store source code elements (classes, methods, fields, etc.) in a language-independent way. The FAMIX meta-model was used to develop a variety of maintenance tools, including a refactoring engine, named Moose, for Java and Smalltalk programs. That work differs from ours for focusing exclusively on the language-independence requirement. In particular, the Moose refactoring engine uses an in-house set of source code models and

manipulation tools, which may severely restrict its reusability. ReFaX, in contrast, relies on open, easilyreplaceable XML standards and technologies, and thus provides a much higher degree of flexibility and reusability.

8. Conclusions and future work This paper presented RefaX, an XML-based framework created to facilitate the development of refactoring tools. The framework offers a number of services to support, among other activities, conversion of source code artifacts to an XML representation; storage of the new source code representation in an XML-based repository; verification and execution of refactoring operations; and conversion of the (updated) XML source code representation back to its original format. Our main conclusions can be summarized as follows: • The development of refactoring operations with RefaX proved not only feasible, but also build confidence that using XML to decouple process from technology can be an important contribution towards more reusable maintenance tools. • The use of open XML standard offers developers with the possibility of choosing among a large variety of tools and technologies at each stage of the refactoring process. • The three dimensions of independence (i.e., scheme, language, and technology) supported by the framework bring an extra level of flexibility, as they allow developers, for example, to switch XML schema without the need to replace the query processor, or to use different storage media and query engines with the same target programming language. • RefaX analysis and code access functions could be used as a basis upon which to develop others types of maintenance tools, such as reverse engineering and code analysis tools. We are currently working to increase the number of refactorings available in the framework. We also intend to create new RefaX instances for other object-oriented programming languages, particularly C++. It is our interest to apply RefaX-based tools (e.g., RefaX4J) to large systems, in order to investigate their scalability, perhaps using different XML processing and storage technologies, and to compare their performance with the performance of existing refactoring tools. Another natural line for future work is to integrate RefaX tools with existing IDE’s, so as to improve their usability. Work in this direction is underway.

9. References [1] Badros, G. J., “JavaML : A Markup Language for Java Source Code”, in Proceedings of the 9th International World

Wide Web Conference (WWW9), Amsterdam, Netherlands, May 13-15, 2000. [2] BeaultyJ Home Page. Available at http://beautyj.berlios.de/beautyJ.html. Accessed on 04/03/2004. [3] Beck, K. “Extreme Programming Explained: Embrace Change”. Addison-Wesley, 1999. [4] C# Refactoring Tool home page. Available http://dotnetrefactoring.com/. Accessed on 04/03/2004.

at

[5] Clifton, G. T. Leavens, C. Chambers, and T. Millstein. “MultiJava: Modular open classes and symmetric multiple dispatch for java”. In Proceedings of OOPSLA 2000, October, 2000, pp. 130-145. [6] Collard, M.L, Kagdi, H.H., and Maletic, J.I. “An XMLBased Lightweight C++ Fact Extractor”. In Proc. of the 11th IEEE International Workshop on Program Comprehension (IWPC ‘03), Portland, USA, May 10-11, 2003. [7] Exist Home Page. Available at http://exist.sourceforge.net. Accessed on 04/03/2004. [8] Fowler, M. Refactoring. “Improving the Design of Existing Programs”. Addison-Wesley. 1999. [9] Gamma, E., Helm, R., Johnson, R., and Vlissides, J. “Design Patterns: Elements of Reusable Object-Oriented Software”. Addison-Wesley, 1994. [10] Holt, R. C., Winter, A., and Schürr, A. “GXL: Toward a Standard Exchange Format”, in Proc. of the 7th Working Conf. on Reverse Engineering (WCRE’00), Brisbane, Australia, November, 2000, pp.162-171. [11] IPSI-XQ Home page. Available http://www.ipsi.fraunhofer.de/oasys/projects/ipsixq/index_e.html. Accessed on 04/03/2004.

at

[12] JFactor Home page. Available at http://www.instantiations.com/jfactor/. Accessed on 04/03/2004. [13] Jikes Home page. Available 124.ibm.com/developerworks/oss/jikes/. 04/03/2004.

at http://wwwAccessed on

[14] Lehti, P. “Design and implementation of a Data Manipulation Processor for an XML Query Language”. Ph.D. Thesis, Technical University of Darmstadt, Germany. 2001. [15] Maletic, J.I., Collard, M.L. and Marcus, A., “Source Code Files as Structured Documents”, in Proc. of the 10th Int. Workshop on Program Comprehension (IWPC ’02), Paris, France, June, 2002, pp. 289-292. [16] Mammas, E. and Kontogiannis, C., “Towards Portable Source Code Representations Using XML”, in Proc. of the 7th Working Conf. on Reverse Engineering (WCRE’00), Brisbane, Australia, November, 2000, pp. 172–180.

[17] Mayrhauser, A. and Marie Vans, A., “Program Comprehension During Software Maintenance and Evolution”. IEEE Computer, August 1995, Vol. 28, No. 8, pp. 44–55. [18] Mens, T., Tourwé, T. “A Survey of Software Refactoring”. IEEE Transactions on Software Engineering, February, 2004, Vol. 30, n.2. [19] Opdyke, W.F. “Refactoring: A Program Restructuring Aid in Designing Object-Oriented Aplications Framework”. Ph.D. Thesis, Univ. of Illinois at Urbana-Champaign.1992. [20] Pressman, Roger S. “Software Engineering – Practitioner’s Approach”. McGraw-Hill, 5th Edition, 2000. [21] Ret4J Home Page. Available http://www.alphaworks.ibm.com/tech/ret4j. Accessed 04/03/2004.

A at on

[22] Roberts, D. B. “Practical Analysis for Refactoring”. Ph.D. Thesis, Univ. of Illinois at Urbana-Champaign. 1999. [23] SAX Home page. Available at http://www.saxproject.org. Accessed on 04/03/2004. [24] Tamino Home Page. Available at http://www.softwareag.com/tamino. Accessed on 04/03/2004. [25] Tatarinovi, I., Ives, Z.G., Halevy, A .Y., Weld, D.S. "Updating XML". In Proc. of ACM Special Interest Group on Management of Data (SIGMOD 2001), California, USA, May 21- 24. 2001. [26] Tichelaar, S. et all. “A Meta-model for LanguageIndependent Refactoring”, in Proc. of International Symposium on Principles of Software Evolution (ISPSE 2000), Kanazawa, Japan, November 01-02. 2000. [27] W3C. “Document Object Model (DOM)”. Available at http://www.w3.org/DOM. Accessed on 04/03/2004. [28] W3C. “Extensible Markup Language (XML)”. Available at http://www.w3.org/TR/xml. Accessed on 04/03/2004. [29] W3C. “XML Path Language (XPath) Version 1.0”. W3C Recommendation November 1999. Available at http://www.w3.org/TR/xpath. Accessed on 04/03/2004. [30] W3C. “XQuery 1.0: An XML Query Language”. W3C Working Draft 12 November 2003. Available at http://www.w3.org/TR/xquery/. Accessed on 04/03/2004. [31] W3C. “XSL Transformations (XSLT) Version 1.0”. W3C Recommendation November 1999. Available at http://www.w3.org/TR/xslt. Accessed on 04/03/2004. [32] XIndice Home Page. Available at http://www.xreftech.com/. Accessed on 04/03/2004. [33] XML:DB. “XUpdate – XML Update Language Working Draft”. Available at http://www.xmldb.org/xupdate/. Accessed on 04/03/2004.

RefaX: A Refactoring Framework Based on XML

system to improve its internal quality and preserving its external .... technologies, such as XSLT [29], or as an API for extracting or .... converting the original source code files selected by the user into the ..... http://beautyj.berlios.de/beautyJ.html.

309KB Sizes 0 Downloads 214 Views

Recommend Documents

SilkRoute: A Framework for Publishing Relational Data in XML
virtual XML view over the canonical XML view; and an application formulates an ... supported by the NSF CAREER Grant 0092955, a gift from Microsoft, and ... serialization format, a network message format, and most importantly, a uni-.

A Multiple Layered Spatial Data Integration Framework Based on ...
JAVA. RMI. Access. Local. Remote. NetBIOS. TCP/IP. Figure 5 shows another portion of ontology of the Persistence category. Its related concepts are Format, Access, .... Middleware. Figure 6 shows the process for data search/query/integration from the

A Multiple Layered Spatial Data Integration Framework Based on ...
modeling, data mining, textual analysis, and statistical techniques. ... model which can be converted to database schema, or a result of a data mining .... Excel. Interface. POP3. Distributed. API. WebService. ODBC. DCOM. CORBA. JAVA. RMI. Access. Lo

G2 Remoting: A Cycle Stealing Framework based on ...
A dedicated server machine is used as the physical manifestation of a virtual parallel machine on which remote objects logically reside from the programmers ... remote objects are not, however, physically created on this server machine; ..... example

Tai Chi synthesizer: a motion synthesis framework based on key ...
presents a novel framework for synthesizing new motions based on given motion manuals .... exercise manuals, a graphical user interface based on ..... the table is considered as a node and two adjacent .... Lan C, Lai JS, Wong MK, Yu ML.Missing:

A Framework to Optimize Biodiversity Restoration Efforts Based on ...
tinguishing ecological systems that are capable to recover by autogenic processes from ... chances of restoration success, defined as the best cost/benefit outcome. ..... tivity with little biological data (Minor and Urban 2007) or even considering .

A Modular Verification Framework Based on Finite ...
strongly connect components that we will talk about from now on. ..... 0: no push button; 1: using push button1; 2: using push buttons 1 &. 2; using push buttons 1 ...

a framework based on gaussian mixture models and ...
Sep 24, 2010 - Since the invention of the CCD and digital imaging, digital image processing has ...... Infrared and ultraviolet radiation signature first appears c. .... software can be constantly upgraded and improved to add new features to an.

SilkRoute: A Framework for Publishing Relational Data in XML
To implement the SilkRoute framework, this work makes two key technical ... for selecting a good decomposition plan; the algorithm takes as input estimates of query and data ...... else . Fig. ...... nationkey CHAR(10), phone CHAR(10)).

A JavaScript Framework for Visual and Native XML Editors (PDF ...
Official Full-Text Paper (PDF): A JavaScript Framework for Visual and Native XML Editors. ... 2. Related Work. ...... (2003), an XML-oriented forms framework intended to replace HTML forms, has also. not been implemented in most browsers to ...

A Solution for Comparison based Conversion of XML ...
XML specification leaves the interpretation of the data to the applications that read it. Due to this, each ... The development challenge, capabilities and limitations of the converter, and assumptions ... communities in World Wide Web requires.

Search-based Refactoring: Towards Semantics ...
Unlike for other programming paradigms, grouping data .... natural language processing, and other related areas. In all ...... [24] http://ganttproject.biz/index.php.

Fast Shape Index Framework based on Principle ...
Some other system like IBM's Query By Image Content (QBIC) .... 752MB memory LENOVO Laptop running Windows XP Media Center operating system.

A New Framework Based on Petri-Net and Related ...
Nowadays, there are many analytic, formal and simulation techniques for modeling and analysis of systems. Formal methods are used for analysis and verification of systems. In modeling large and complex systems, it is necessary to use different formal

A Case for XML - IJEECS
With these considerations in mind, we ran four novel experiments: (1) we measured instant messenger and RAID array throughput on our 2-node testbed; (2) we ...

A Case for XML - IJEECS
butions. For starters, we propose a novel methodology for the investigation of check- sums (TAW), which we use to verify that simulated annealing and operating systems are generally incompatible. We use decen- tralized archetypes to verify that super

Annual list of specific contracts based on a framework contract - 2016
Jun 28, 2017 - EMA/2012/46/HR – Lot 3. Capita Business Services. Ltd. GBP 11,528.67. EMA/2012/47/HR ... EMA/2014/16/COM. European Service Network.

A Process-Theoretic State-Based Framework for Live ...
(3) the supervised system, where in order to ensure safety, the synthesis procedure ... using a process theory that uses signal emission [6] to specify the state-based ... the prominent (state-based) model checker UPPAAL [10]. To couple both ...

A Potential-based Framework for Online Learning with ...
This framework immediately yields natural generalizations of existing algorithms. (e.g. Binomial Weight [CFHW96] or Weighted Majority [LW94, Vov95]) onto online learning with abstentions. 1 Introduction. In many applications of machine learning, misc

A Potential-based Framework for Online Learning with ...
Show xt ∈ /. Predict yt ∈ 1-1, +1, +l. Reveal yt ∈ 1-1, +1l. Reliable predictions on non-abstention examples. Performance Metrics: ▷ Mistakes: ∑t I(yt = -yt) ...