Featureous - IEEE Computer Society

1 downloads 0 Views 306KB Size Report
The Maersk Mc-Kinney Moller Institute. University of Southern Denmark. {ao, bnj}@mmmi.sdu.dk. Abstract—Feature-centric comprehension of source code is.
18th IEEE International Conference on Program Comprehension

Featureous: A Tool for Feature-Centric Analysis of Java Software Andrzej Olszak, Bo Nørregaard Jørgensen The Maersk Mc-Kinney Moller Institute University of Southern Denmark {ao, bnj}@mmmi.sdu.dk We present our attempt at unifying feature-centric analysis of legacy Java programs and ensuring scalability of analysis with respect to the number of features and the size of a program’s source code. Our approach provides five analytical views, which are structured along three dimensions of perspective, abstraction, and granularity in order to establish a clear separation of analytical concerns and allow for controlling the cognitive complexity of the analysis. The concrete analytical views are defined by integrating and enhancing a number of existing complementary analysis techniques. The presented approach is implemented as a NetBeans IDE plugin called Featureous. In the remainder, we present an overview of our approach and demonstrate how to use Featureous to conduct feature-centric comprehension of a legacy program.

Abstract—Feature-centric comprehension of source code is necessary for incorporating user-requested modifications during software evolution and maintenance. However, such comprehension is difficult to achieve in case of large objectoriented programs due to the size, complexity, and implicit character of mappings between features and source code. To support programmers in overcoming these difficulties, we present a feature-centric analysis tool, Featureous. Our tool extends the NetBeans IDE with mechanisms for efficient location of feature implementations in legacy source code, and an extensive analysis of the discovered feature-code relations through a number of analytical views.

I.

INTRODUCTION

Software evolution and maintenance involve adoption of user-originated functional requirements, change requests, and error reports. As users perceive software through its externally-observable behavior, they tend to specify their input in terms of user-observable features rather than concrete implementation details [1]. Hence, it is the task of programmers to relate the problem-domain descriptions based on features, to solution-domain descriptions in the software’s source code. In case of object-oriented programs, relating features to their implementations is, however, a difficult task, since features are not the primary units of their decomposition. The result is that implementations of features are not represented explicitly in programs’ source codes, and they exhibit the problems of interleaving [2] and delocalization [3]. The implicitness and complexity of feature-code relations are thus major factors impeding feature-centric comprehension of object-oriented software. Some of the existing attempts at improving this situation focused on recovering and making the feature-code traceability explicit to programmers [4]. Despite of its importance, establishing explicit traceability is not enough to deal with the inherent complexity and size of the many-tomany relations between features in code units. The concern of reducing the complexity of analysis was recognized and addressed in a number of analytical approaches by considering features as first-class analysis entities [5]. Yet, there exists no common viewpoint on how to unify the existing approaches in terms of a single coherent conceptual framework that would allow leveraging their individual advantages. Finally, an appropriate tool support for the complex task of feature-centric analysis is needed in order to guide the comprehension efforts in a systematic fashion, automate repetitive calculations, and ensure reproducibility of the comprehension process.

978-0-7695-4113-6/10 $26.00 © 2010 IEEE DOI 10.1109/ICPC.2010.27

II.

FEATUREOUS

There are a total of five analytical elements contained in our approach and implemented in our tool Featureous. These elements address different analytical concerns that we recognize to be relevant to feature-centric analysis. The conceptual framework behind our approach consists of three dimensions of analytical concerns. The first of them is perspectives. We support three complementary perspectives on feature-code traceability links (i.e. the computational-unit perspective, the feature perspective and the feature-relations perspective), which allow us to decouple investigations of the complex many-to-many feature-code relations into investigations of several one-to-many mappings. In order to control the amount of information presented to an analyst, we allow the perspectives to be examined at three levels of analytical abstraction: the characterization, the correlation and the traceability levels.

B

A

C

E

F Figure 1. Feature-centric analysis in Featureous.

44

D

The scalability of the approach with respect to number of features and size of source code is supported by adjustable levels of granularity of features (i.e. features and featurepartitions created manually or automatically based on canonical features [7]) and computational units (i.e., packages, classes, methods). An overview of the user interface of Featureous, which implements our approach, is shown in Figure 1. The technical solution behind Featureous involves a tight integration of analytical views with Java development support in the NetBeans IDE. Furthermore, we provide an API that exposes the information about feature-code traceability, so that additional views can be developed on top of it by third parties without the need for recompiling the tool itself. III.

characterization (D). These relations are visualized using two graphs, whose vertices represent features and edges depict relations. The edges are, furthermore, affinity-colored, and their thickness reflects the strength of relation. The details of the three analytical perspectives are presented in the correlation element (E). This element offers matrix-based and graph-based visualizations of the details of correspondences between features, computational units, and objects. The correlation is expressed using affinity-coloring. Finally, the traceability element (F) provides navigable bi-directional traceability links between features and concrete fragments of a program’s source code. The first mechanism employed by this element is the feature inspector that provides a navigable traceability from features to source code. The second mechanism is the coloring of source code in the NetBeans’ editor that characterizes individual fragments of source code by affinity coloring and the names of their corresponding features. It is our experience from application to the JHotDraw project that the analytical views provided in Featureous provide an efficient support for both top-down and bottomup comprehension strategies, and they simplify the understanding of the implementations of features, the relations between them, and the mechanisms used to implement user-observable functionality in existing software.

CONDUCTING FEATURE-CENTRIC ANALYSIS

In this section, we shortly demonstrate an example scheme for conducting a feature-centric analysis using Featureous. Feature-centric analysis operates on the traceability links between features and object-oriented source code. After a subject project’s source code is opened in NetBeans IDE, traceability between features and computational units has to be established. We do this by using the dynamic feature location mechanism [6] incorporated in Featureous. After a list of a program’s features is recovered from its documentation, or its graphical user interface, for every feature we manually annotate its feature entry points – the methods through which a program’s control flow enters implementations of features. An annotated program is then transparently instrumented with a tracing aspect in order to collect the methods, classes, and objects used by features that we execute at a program’s run-time. This information is then saved in the form of feature-trace files (marked as A in the overview of Featureous in Figure 1.), which serve as an input to further analysis. In a scenario of top-down comprehension, we begin the feature-centric analysis by investigating a high-level summary of how a program’s computational units participate in implementations of features. The computational-unit characterization (B) gives a high-level summary of the participation of a program’s classes in feature implementations. This is represented by an affinity-coloring scheme [5] enhanced with gradients representing the strength of affinity membership, and a measure of features’ tangling of features in terms of individual computational units. To view feature-code relations from the perspective of features we use the feature-characterization element (C), which allows for assessment of the distribution of feature implementations over computational units. The delocalization of feature implementations is represented by affinity coloring and a measure of scattering of feature implementations among a program’s computational units. In order to get an overview of static relations (based on code sharing) and dynamic relations (based on object cousage) among features we use the feature-relations

IV.

DISCUSSION

In this paper, we have introduced Featureous – a tool supporting unified feature-centric analysis of legacy Java software. We believe that the tool, as well as the conceptual framework behind it, provides a useful platform for conducting feature-centric analysis in real-world projects and for further research on the nature of feature implementations in object-oriented software. The Featureous tool is available at http://ecosoc.sdu.dk/coe/Featureous . REFERENCES [1]

[2]

[3] [4]

[5]

[6]

[7]

45

C.R. Turner, A. Fuggetta, L. Lavazza, and A.L. Wolf, “A conceptual basis for feature engineering,” J. Syst. Softw., vol. 49, 1999, pp. 3– 15. S. Rugaber, K. Stirewalt, and L.M. Wills, “The Interleaving Problem in Program Understanding,” Reverse Engineering, Working Conference on, vol. 0, 1995, p. 166. S. Letovsky and E. Soloway, “Delocalized Plans and Program Comprehension,” IEEE Softw., vol. 3, 1986, pp. 41–49. D. Röthlisberger, O. Greevy, and O. Nierstrasz, “Feature driven browsing,” ICDL '07, New York, NY, USA: ACM, 2007, pp. 79– 100. O. Greevy and S. Ducasse, “Correlating Features and Code Using a Compact Two-Sided Trace Analysis Approach,” CSMR '05, Washington, DC, USA: IEEE Computer Society, 2005, pp. 314–323. A. Olszak and B.N. Jørgensen, “Remodularizing Java programs for comprehension of features,” FOSD '09, New York, NY, USA: ACM, 2009, pp. 19–26. J. Kothari, T. Denton, A. Shokoufandeh, and S. Mancoridis, “Reducing Program Comprehension Effort in Evolving Software by Recognizing Feature Implementation Convergence,” ICPC '07, Washington, DC, USA: IEEE Computer Society, 2007, pp. 17–26.