Stimulating reuse with an automated active code search tool

Download Report

Transcript Stimulating reuse with an automated active code search tool

Stimulating reuse with an
automated active code search
tool
Júlio Lins – [email protected]
André Santos (Advisor) – [email protected]
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
2
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
3
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
4
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
5
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
6
Scenario
Keywords:
Cadastra uma conta
corrente na base de dados
inserir conta
Method Signature:
Conta -> void
Reuse in Software Engineering Group
7
Architecture
Eclipse IDE
Notifies
Presents
Agent
Presenter
Reuse in Software Engineering Group
Searches
Repository
Interface
8
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
9
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
10
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

For each repeated search result: p = p2


 Each result has a priority
Reuse in Software Engineering Group
11
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
12
Repository structure
Repository
Interface
Source code
copy
File system
Indexed
documents
Code
structure
Apache Lucene
SGBD
Reuse in Software Engineering Group
13
Technologies used

Apache Lucene



IBM Cloudscape



Open source free-text indexing tool
Provides a built-in java source code indexer
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
14
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
15
DEMO
Reuse in Software Engineering Group
16
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
17
Any new ideas?
Reuse in Software Engineering Group
18
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
19