Mining Implementation Recipes of Framework-Provided ... - CiteSeerX

0 downloads 0 Views 112KB Size Report
Mining Implementation Recipes of Framework-Provided Concepts in Dynamic Framework API Interaction Traces. Abbas Heydarnoori. David R. Cheriton School ...
Mining Implementation Recipes of Framework-Provided Concepts in Dynamic Framework API Interaction Traces Abbas Heydarnoori

Krzysztof Czarnecki

David R. Cheriton School of Computer Science, University of Waterloo, Canada [email protected]

Electrical and Computer Engineering Department, University of Waterloo, Canada [email protected]

Abstract Application developers often apply the Monkey See/Monkey Do rule for framework-based application development, i.e., they use existing applications as a guide to understand how to implement a desired framework-provided concept (e.g., a context menu in an Eclipse view). However, the code that implements the concept of interest might be scattered across and tangled with code implementing other concepts. To address this issue, we introduce a novel framework comprehension technique called FUDA (Framework API Understanding through Dynamic Analysis). The main idea of this technique is to extract the implementation recipes of a given framework-provided concept from dynamic traces with the help of a dynamic slicing approach integrated with clustering and data mining techniques. In this demonstration, we present the prototype implementation of FUDA as two Eclipse plug-ins, and use them to generate the implementation recipes for a number of concepts in Eclipse views and GEF editors by using only a few example applications. Categories and Subject Descriptors D.2.7 [Software Engineering]: Distribution, Maintenance, and Enhancement— reverse engineering; D.2.3 [Software Engineering]: Coding Tools and Techniques—object-oriented programming General Terms Design, Documentation, Experimentation. Keywords Object-Oriented Software Frameworks, Framework Comprehension, FUDA, Dynamic Slicing, Clustering, Data Mining.

1.

Introduction

Object-oriented software frameworks are one of the most effective reuse technologies available nowadays since they en-

Copyright is held by the author/owner(s). OOPSLA’07, October 21–25, 2007, Montr´eal, Qu´ebec, Canada. ACM 978-1-59593-786-5/07/0010.

able the reuse of both the design and implementation in a specific domain. However, many modern frameworks are often difficult to master because of their complex Application Programming Interfaces (APIs) and usually incomplete user documentation. To address these challenges, application developers are encouraged to apply the Monkey See/Monkey Do rule [3]:“Use existing framework examples as a guide to develop new applications”. Although applying the Monkey See/Monkey Do rule is an effective way for framework-based application development, locating the code that implements a concept of interest in example applications source code can be a non-trivial task. To cope with this problem, we developed a novel framework comprehension technique called FUDA (Framework API Understanding through Dynamic Analysis). In FUDA, a framework-provided concept is defined as a functionality that is realized in the example application’s source code by using the framework’s API. Furthermore, the concept has to have a visible behavior that can be triggered by the user through the graphical or programmatic interface of the application. The key idea of FUDA is to run a number of example applications that implement the desired frameworkprovided concept; collect all runtime interactions between them and the framework API (i.e., calls and callbacks); and mark those ones that happen when that concept is invoked with the help of a trace marker utility. The collected dynamic traces are then sliced with respect to the marked interactions by applying a dynamic slicing approach introduced in [4]. The purpose of this step is to find other interactions that might be relevant to the implementation of the desired concept and happen either before or after invoking it. Finally, the resulting dynamic information is processed in a batchlike manner using clustering and data mining techniques to extract the concept implementation recipes. Each implementation recipe consists of a list of commands that specify what framework-provided abstractions are involved in the implementation of that concept. Interested readers are referred to our technical report [4] for more details about the FUDA technique.

Recipe Support = 75% Supporting Applications = Concern Mapper, Coverlipse, Version Tree Instantiate org.eclipse.jface.action.Separator+ Instantiate org.eclipse.jface.action.MenuManager Implement menuAboutToShow Call org.eclipse.jface.action.MenuManager.setRemoveAllWhenShown Call org.eclipse.jface.action.MenuManager.createContextMenu Call org.eclipse.jface.action.MenuManager.addMenuListener Call org.eclipse.jface.action.IMenuManager.add+ Call org.eclipse.jface.action.Action.setToolTipText+ Call org.eclipse.jface.action.Action.setImageDescriptor+

Figure 1. An example implementation recipe generated by the FUDA technique for the concept context menu in an Eclipse view.

In this demonstration, for each of the above concepts, we run a few sample applications and invoke that concept. At runtime, we use the TCP tool to record all interactions between the example applications and the framework API, and mark those ones that happen when the concept of interest is invoked. Then, the marked dynamic traces collected by the TCP tool are fed into the FCP tool as input to process them in a batch-like manner and generate the concept implementation recipes. We show that the generated implementation recipes by the FUDA technique are comparable to those found in the framework API documentation.

4. About the Authors 2.

Prototype Implementation

We prototyped the FUDA approach in Java (SDK 5.0) as two separate but related plug-ins in Eclipse 3.2: Trace Collector Plug-in (TCP) to collect and mark the runtime interactions between the example applications and the framework API, and Framework Comprehension Plug-in (FCP) that applies the FUDA technique on the collected dynamic traces by the TCP tool to extract the implementation recipes for the desired framework-provided concept. We have implemented two different versions of the TCP tool so far: one that uses the Probekit utility of the Eclipse TPTP (Test & Performance Tools Platform) [2] as the underlying profiler, and the second one that uses AspectJ to instrument the example applications. For the information about their advantages and disadvantages, interested readers are referred to [4]. To implement the FCP tool, we used LCM ver. 3.0 [5] as the underlying data mining engine integrated with our implementations of the clustering and dynamic slicing techniques. Fig. 1 represents a sample implementation recipe generated by our prototype implementation of FUDA for the concept context menu in an Eclipse view. This concept implementation recipe represents the percentage of example applications supporting it, name of the supporting example applications, and a list of commands that specify what framework API classes should be instantiated by the application, what methods should be implemented on the application’s side, and what framework API methods should be called by the application. In this recipe, a plus (+) sign at the end of the command indicates that that command can be executed multiple times.

3.

Description of Demo

During the demonstration, the audience will see how it is possible to determine the implementation recipes for a desired framework-provided concept by applying the FUDA technique on only a few different example applications. For this purpose, we will use the TCP and FCP tools to generate the implementation recipes for the following sample concepts: (1) a context menu in an Eclipse view, and (2) drawing a figure in a GEF (Graphical Editing Framework) [1] editor.

Abbas Heydarnoori received the M.Sc. (2001) degree in Software Engineering from the Sharif University of Technology. Currently, he is a Ph.D. candidate in the School of Computer Science at the University of Waterloo. He is a member of the Generative Software Development Lab. Previously, he worked on the deployment of componentbased applications into distributed environments. Currently, he works on comprehending object-oriented software frameworks through dynamic analysis. His main research interests include framework comprehension, concept location, and dynamic analysis in the context of framework comprehension. Krzysztof Czarnecki received the M.Sc. (1994) from the California State University at Sacramento, Dipl.-Inf. (1995) from the Ilmenau Technical University, and Ph.D. (1998) from the Ilmenau Technical University. Currently, he is an Associate Professor in Electrical and Computer Engineering Department at the University of Waterloo where he leads the Generative Software Development Lab. Before coming to Waterloo, he spent eight years at DaimlerChrysler Research working on the practical applications of generative programming. He co-authored the book “Generative Programming: Methods, Tools, and Applications” (AddisonWesley, 2000). His main research interests include generative software development, model-driven software development, software product lines, and software design.

References [1] Eclipse Graphical Editing Framework (GEF). http://www. eclipse.org/gef/. [2] Eclipse Test & Performance Tools Platform (TPTP). http: //www.eclipse.org/tptp/. [3] E. Gamma and K. Beck. Contributing to Eclipse: Principles, Patterns, and Plugins. Addison-Wesley, 2003. [4] A. Heydarnoori and K. Czarnecki. Comprehending ObjectOriented Software Frameworks API through Dynamic Analysis. Technical Report CS-2007-18, University of Waterloo, Waterloo, ON, Canada, 2007. [5] T. Uno, M. Kiyomi, and H. Arimura. LCM ver.3: Collaboration of Array, Bitmap and Prefix Tree for Frequent Itemset Mining. In OSDM, pages 77–86. ACM Press, 2005.