Stimulating reuse with an automated active code search tool

19
Stimulating reuse with an automated active code search tool Júlio Lins – [email protected] André Santos (Advisor) – [email protected]

description

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 - PowerPoint PPT Presentation

Transcript of Stimulating reuse with an automated active code search tool

Page 1: 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]

Page 2: Stimulating reuse with an automated active code search tool

Reuse in Software Engineering Group2

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?

Page 3: Stimulating reuse with an automated active code search tool

Reuse in Software Engineering Group3

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

Page 4: Stimulating reuse with an automated active code search tool

Reuse in Software Engineering Group4

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

Page 5: Stimulating reuse with an automated active code search tool

Reuse in Software Engineering Group5

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

Page 6: Stimulating reuse with an automated active code search tool

Reuse in Software Engineering Group6

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)

Page 7: Stimulating reuse with an automated active code search tool

Reuse in Software Engineering Group7

Keywords:Cadastra uma contacorrente na base de dadosinserir conta

Method Signature:Conta -> void

Scenario

Page 8: Stimulating reuse with an automated active code search tool

Reuse in Software Engineering Group8

Architecture

AgentNotifies

RepositoryInterface

Searches

PresenterPresents

Eclipse IDE

Page 9: Stimulating reuse with an automated active code search tool

Reuse in Software Engineering Group9

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

Page 10: Stimulating reuse with an automated active code search tool

Reuse in Software Engineering Group10

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

Page 11: Stimulating reuse with an automated active code search tool

Reuse in Software Engineering Group11

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

Page 12: Stimulating reuse with an automated active code search tool

Reuse in Software Engineering Group12

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

Page 13: Stimulating reuse with an automated active code search tool

Reuse in Software Engineering Group13

Repository structure

RepositoryInterface

Source codecopy

Indexed documents

File system Apache Lucene

Code structure

SGBD

Page 14: Stimulating reuse with an automated active code search tool

Reuse in Software Engineering Group14

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

Page 15: Stimulating reuse with an automated active code search tool

Reuse in Software Engineering Group15

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

Page 16: Stimulating reuse with an automated active code search tool

Reuse in Software Engineering Group16

DEMO

Page 17: Stimulating reuse with an automated active code search tool

Reuse in Software Engineering Group17

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

Page 18: Stimulating reuse with an automated active code search tool

Reuse in Software Engineering Group18

Any new ideas?

Page 19: Stimulating reuse with an automated active code search tool

Reuse in Software Engineering Group19

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.