190 likes | 272 Views
Stimulating reuse with an automated active code search tool. Júlio Lins – jcsl@cin.ufpe.br André Santos (Advisor) – alms@cin.ufpe.br. Context. Locating and retrieving software components if one of the most important problems of reuse
E N D
Stimulating reuse with an automated active code search tool Júlio Lins – jcsl@cin.ufpe.br André Santos (Advisor) – alms@cin.ufpe.br
Context • Locating and retrieving software components if one of the most important problems of reuse • Large reuse repositories make it difficult to find reusable components • Developers tend to reuse components they wrote or previously known components How to locate and present reusable software components? Reuse in Software Engineering Group
Recent techniques for finding software components • Indexing using an uncontrolled vocabulary • Free-text indexing (similar to web search engines) • Indexing using a controlled vocabulary (Facets) • Manual: requires big effort for large repositories • Automatic: indexing tools translate the encountered terms to an equivalent from a set of well defined terms • Signature matching • Formalization of the code structure • May specify semantic with a formal language Reuse in Software Engineering Group
Active Component Repository Systems [YE 2001] • Locate reusable software components relevant to the task at hand • Components in repository are actively located when the developer is programming • Uses the information available on the current piece of software being written • Keywords form the documentation: indexed search • Method signature search Reuse in Software Engineering Group
Benefits • Presents reusable components that might not be known to the developer • Forces the developer to know that what he/she is doing has probably being already done • Automates the job of doing a search into the repository Reuse in Software Engineering Group
Code Searcher • Implements the task-relevant search for the Eclipse platform • It is a plug-in for the Eclipse environment • Detects a creation of a new method or a change in a method signature • Two search methods are used • Keyword search • Signature matching (formal definition is not required) Reuse in Software Engineering Group
Scenario Keywords: Cadastra uma conta corrente na base de dados inserir conta Method Signature: Conta -> void Reuse in Software Engineering Group
Architecture Eclipse IDE Notifies Agent Searches RepositoryInterface Presenter Presents Reuse in Software Engineering Group
Agent • Uses the information available in the IDE for the current method being created or modified • Combines different types of search to present the most relevant components Reuse in Software Engineering Group
Agent plug-in • Listens to changes made to a compilation unit open in a Java editor • The JDT API provides access to • The Java compiler • Source code generator • The refactor • The Eclipse Java parser is very powerful • Provides an object model to the java language elements • Offers an abstract level API Reuse in Software Engineering Group
The search algorithm • One keyword search if executed using the words available in the javadoc main description, plus the method name and the name of the each parameter • Several code structure searches may be run • Method signature matching • Methods that handle the same exceptions • Methods that throws the same exceptions • Each result has a priority • For each repeated search result: p = p2 Reuse in Software Engineering Group
Repository • A reuse repository is previously populated with source code • Three kinds of code • Reusable components • The current system code • Code from previews systems, that may be not read for reuse • The idea is to find similar code and then let the developer decide how the reuse will happen for each case Reuse in Software Engineering Group
Repository structure RepositoryInterface Source codecopy Indexed documents Code structure File system Apache Lucene SGBD Reuse in Software Engineering Group
Technologies used • Apache Lucene • Open source free-text indexing tool • Provides a built-in java source code indexer • IBM Cloudscape • Java embedded relational database • Supports the same SQL as the DB2 • The system may be migrated to a centralized DB2 server • The SGBD technology was chosen due to memory use constraints • Approximately 26MB of memory is needed for the Java 1.4 source • An XML structure requires 72MB Reuse in Software Engineering Group
Presenter • An Eclipse View that may be optionally showed • When open, activates the Agent • Presents the search results ordered by relevance • File name, project, date • Allows the developer to double-click a result • Opens the file in the Java edtior Reuse in Software Engineering Group
DEMO Reuse in Software Engineering Group
Planned new functionalities • Change the passive search to a scrap book page where code can be written • The idea is to locate similar code • Allow access to the javadoc of the reusable component • Include a simple faceted classification • Operating system, platform • Allow the configuration of synonymous for possible keywords • Allows the developer to filter the results Reuse in Software Engineering Group
Any new ideas? Reuse in Software Engineering Group
References • Y. Ye (2001) Supporting Component-Based Software Development with Active Component Repository Systems, Ph.D. Dissertation, Department of Computer Science, University of Colorao at Boulder. Reuse in Software Engineering Group