2 research outputs found
Refactoring and representation independence for class hierarchies
AbstractRefactoring transformations are important for productivity and quality in software evolution. Modular reasoning about semantics preserving transformations is difficult even in typed class-based languages because transformations can change the internal representations for multiple interdependent classes and because encapsulation can be violated by pointers to mutable objects. In this paper, an existing theory of representation independence for a single class, based on a simple notion of ownership confinement, is generalized to a hierarchy of classes and used to prove refactoring rules that embody transformations of complete class trees. This allows us to formalize refactorings that inherently involve class inheritance, such as Pull Up or Push Down Field; moreover, this makes it possible to generalize refactorings previously restricted to change of data representation of private attributes (like Extract Class and Encapsulate Field) to address data refinement of protected attributes, dealing with the impact that the corresponding transformations may cause in the subclasses. The utility of the proposed rules is shown in a relatively extensive case study. Shortcomings of the theory are described as a challenge to other approaches to heap encapsulation and relational reasoning for classes
Using Clustering Techniques to Guide Refactoring of Object-Oriented Classes
Much of the cost of software development is maintenance. Well structured
software tends to be cheaper to maintain than poorly structured software, because
it is easier to analyze and modify. The research described in this thesis concentrates
on determining how to improve the structure of object-oriented classes, the
fundamental unit of organization for object-oriented programs.
Some refactoring tools can mechanically restructure object-oriented classes,
given the appropriate inputs regarding what attributes and methods belong in the
revised classes. We address the research question of determining what belongs in
those classes, i.e., determining which methods and attributes most belong together
and how those methods and attributes can be organized into classes. Clustering
techniques can be useful for grouping entities that belong together; however, doing
so requires matching an appropriate algorithm to the domain task and choosing
appropriate inputs.
This thesis identifies clustering techniques suitable for determining the
redistribution of existing attributes and methods among object-oriented classes,
and discusses the strengths and weaknesses of these techniques. It then describes
experiments using these techniques as the basis for refactoring open source Java
classes and the changes in the class quality metrics that resulted. Based on these
results and on others reported in the literature, it recommends particular clustering
techniques for particular refactoring problems.
These clustering techniques have been incorporated into an open source
refactoring tool that provides low-cost assistance to programmers maintaining
object-oriented classes. Such maintenance can reduce the total cost of software
development