Towards supporting on demand virtual remodularization using program graphs
Download
1 / 53

Towards Supporting On-Demand Virtual Remodularization Using Program Graphs - PowerPoint PPT Presentation


  • 56 Views
  • Uploaded on

Towards Supporting On-Demand Virtual Remodularization Using Program Graphs. David Shepherd, Lori Pollock, and K. Vijay-Shanker. University of Delaware. Overview and Rationale. //Activates the tool for the given view. //Turn on dragtool by adding. public void Tool.activate(). undo action.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Towards Supporting On-Demand Virtual Remodularization Using Program Graphs' - parry


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Towards supporting on demand virtual remodularization using program graphs

Towards Supporting On-Demand Virtual Remodularization Using Program Graphs

David Shepherd, Lori Pollock, and K. Vijay-Shanker

University of Delaware


Overview and rationale
Overview and Rationale Program Graphs

//Activates the tool for the given view.

//Turn on dragtool by adding....

public void Tool.activate()

undo action

update drawing

on-demand

remodularization

save drawing

activate tool

action oriented system

object oriented system


Overview and rationale1
Overview and Rationale Program Graphs

public interface Storable{...

//Store the fields in a file....

undo action

Key Insight: Programmers leave natural language clues that reference concerns

public void Circle.save()

update drawing

activate tool

save drawing

action oriented system

object oriented system


State of the art in feature location aspect mining
State of the Art in Feature Location/Aspect Mining Program Graphs

Low-level Clues

  • Dynamic Information

    • [Wilde ICSM 00], [Michail ICSE 02], [Zhao ICSE 04], [Breu ASE 04], [Ceccato ICSM 05]...

  • Program Structure

    • FEAT, Sextant, JQuery, [Robillard FSE 05]...

  • Information Retrieval

    • [Marcus PhDThesis 03], [ICSE 03]

  • Lexical Information

    • Aspect Mining Tool, Aspect Browser

Complementary

Foundations


A motivating example
A Motivating Example Program Graphs

Recipe Writing Factory

Recipe for Vegetable Soup

  • Place asparagus and onion in a saucepan with 1/2 cup vegetable broth. Bring the broth to a boil, reduce heat and let simmer until the vegetables are tender.

  • Reserve a few asparagus tips for garnish. Place remaining vegetable mixture in an electric ...

Procedural instructions are easy to read


Choosing a dominant decomposition
Choosing a Dominant Decomposition Program Graphs

Recipe Writing System 1.0


Choosing a dominant decomposition1
Choosing a Dominant Decomposition Program Graphs

Recipe Writing System 1.0

  • asparagus

  • Place asparagus in a saucepan.

  • Reserve a few asparagus tips for garnish

  • Garnish with reserved asparagus tips.

  • flour

  • Sprinkle flour into the butter. Do not let the flour brown.

  • butter

  • Melt butter in the pan that was used for simmering the asparagus and onions…stir.

  • salt

  • Sprinkle salt into the butter.

  • soy milk

  • Stir the milk into the saucepan.

  • yogurt

  • Whisk yogurt into the mixture

OO decomposition provides many benefits

Recipe for Vegetable Soup

  • List ingredients = {asparagus, onion...}

  • Bowl b = new Bowl();

  • while( ingredients.hasNext){

    • Ingredient ingred = ingredients.next();

    • ingred.place(b);

  • ...


Action oriented cccs appear
Action-Oriented CCCs Appear Program Graphs

  • asparagus

  • Place asparagus in a saucepan.

  • Reserve a few asparagus tips for garnish

  • Garnish with reserved asparagus tips.

  • flour

  • Sprinkle flour into the butter. Do not let the flour brown.

  • butter

  • Melt butter in the pan that was used for simmering the asparagus and onions…stir.

  • salt

  • Sprinkle salt into the butter.

  • onion

  • Place onion in the saucepan

  • yogurt

  • Whisk yogurt into the mixture

OOP causes scattered actions


Evolution causes scattered actions
Evolution Causes Scattered Actions Program Graphs

//Place the Beef into the pan

place(Pan p){

checkIfFitsInPan(p);

actuallyPlaceInPan(p);

}

Beef

place(p)

checkIfFitsInPan(p)

actuallyPlaceInPan(p)

//Make sure the beef fits in the pan,

//before Placing the Beef into the pan

checkIfItFitsInPan(Pan p){

...

}

//Place the beef into the pan

actuallyPlaceInPan(Pan p){

...

}

Evolution causes more scattered actions


Maintenance tasks involve scattered actions
Maintenance Tasks Involve Scattered Program GraphsActions

Something goes wrong when I place ingredients in the saucepan.

Maintenance tasks require action location


How can we find actions in a noun s world
How can we find Program Graphsactions in a noun's world?

Our Strategy

  • Extract natural language clues

  • Query clues and remodularize


Extract Program Graphs Clues with NLP

//Make sure the beef fits in the pan,

//before placing the beef into the pan

Beef.checkIfItFitsInPan(Pan p){

...

}

//Make sure the beef fits in the pan,

//before placing the beef into the pan

Beef.checkIfItFitsInPan(Pan p){

...

}

//Place the onion in the pan

Onion.place(Pan p){

...

}

place onion

place beef, check beef

//Place the beef into the pan

Beef.place(Pan p){

checkIfFitsInPan(p);

actuallyPlaceInPan(p);

}

//Place the beef into the pan

Beef.place(Pan p){

checkIfFitsInPan(p);

actuallyPlaceInPan(p);

}

//Place the beef into the pan

Beef.actuallyPlaceInPan(Pan p){

...

}

//Place the beef into the pan

Beef.actuallyPlaceInPan(Pan p){

...

}

place beef

place beef

Key Insight:Use language clues to extract actions


Query Program Graphs Clues and Remodularize

Virtual Source File

//Make sure the beef fits in the pan,

//before placing the beef into the pan

Beef.checkIfItFitsInPan(Pan p){

...

}

simple query: place

//Place the beef into the pan

Beef.actuallyPlaceInPan(Pan p){

...

}

//Place the onion in the pan

Onion.place(Pan p){

...

}

//Place the beef into the pan

Beef.place(Pan p){

checkIfFitsInPan(p);

actuallyPlaceInPan(p);

}

From OO code to Action-Oriented code!



What to extract
What to Extract Program Graphs

Something goes wrong when I place ingredients into the saucepan.

Something goes wrong when I place beef into the saucepan.

  • information about actions

    • verbs

    • direct-objects

      ex: Place the item in the pan

      ex2: Place the beef in the pan

Our Strategy: extract verb and direct object pairs


How to extract clues
How to extract clues Program Graphs

Two types of extraction

class Beef{

//Chop the beef into cubes.

chop(){

unwrap();

slice(CUBES);

}

}

Extraction from comments

Extraction from method signatures


Extracting clues from comments
Extracting Clues from Program GraphsComments

  • Part-of-speech tagging

  • Chunking

  • Role assignment

Remove an item from a cart

Remove<v> an<dt> item<n> from<p> a<dt> cart<n>

Remove<v>[an item]<noun phrase>[from [a cart] <noun phrase>] <prepositional phrase>

Remove

item

rule: when a verb is followed by a noun phrase, extract


Extracting clues from signatures
Extracting Clues from Signatures Program Graphs

  • Process method name

  • Use hierarchy of rules to classify

  • Use classification to extract

class Beef{

//Chop the beef into cubes.

chop(){

unwrap();

slice(CUBES);

}

}


Extracting clues from signatures1
Extracting Clues from Signatures Program Graphs

  • Process method name

  • Use hierarchy of rules to classify

  • Use classification to extract

class Beef{

//Chop the beef into cubes.

chop(){

unwrap();

slice(CUBES);

}

}

chop<v>

chop<v> [the beef]<noun phrase>


Extracting clues from signatures2
Extracting Clues from Signatures Program Graphs

Hand Tuned Rule Tree

  • Process method name

  • Use hierarchy of rules to classify

  • Use classification to extract

class Beef{

//Chop the beef into cubes.

chop(){

unwrap();

slice(CUBES);

}

}

Example Classification: method has no parameters and the method name is a verb

chop<v>


Extracting clues from signatures3
Extracting Clues from Signatures Program Graphs

  • Process method name

  • Use hierarchy of rules to classify

  • Use classification to extract

  • Example Extraction Rule:

  • get verb from method name

  • get DO from class name

class Beef{

//Chop the beef into cubes.

chop(){

unwrap();

slice(CUBES);

}

}

chop beef


Storing the clues
Storing the Clues Program Graphs

Action-Oriented Identifier Graph (AOIG)

verb1

verb2

verb3

DO1

DO2

DO3

verb1, DO1

verb1, DO2

verb3, DO2

verb2, DO3

use

use

use

use

use

use

use

use

source code files


Storing the clues1
Storing the Clues Program Graphs

Action-Oriented Identifier Graph (AOIG)

chop

grill

puree

onion

beets

steak

chop, onion

chop, beets

puree, beets

grill, steak

use

use

use

use

use

use

use

use

source code files


How accurate is extraction
How Accurate is Extraction? Program Graphs

Survey of AOIG-Builder's Accuracy

Avg. Precision

95%

Avg. Recall

83%

Good Precision and Recall


Costs of building the aoig per source file
Costs of Building the AOIG Program Graphsper source file

  • Space

    • O(number of methods)

    • minimal

  • Time

    • O(number of methods)

    • 10 seconds for a large source file with lots of multi-line comments

Reasonable cost - can be done incrementally


Contributions
Contributions... Program Graphs


Action oriented view
Action-Oriented View Program Graphs

  • High-level CCCs instead of low-level

    • clear hypothesis of why actions are CCCs

  • Useful type of CCC

    • maintainers are looking for actions


Contributions continued
Contributions Program Graphs(continued)

  • Action-Oriented View

  • Combined NLP+Program Analysis (NLPA)

  • Developed the AOIG for virtual remodularization

  • Applied AOIG to

    • Feature Location*

    • Aspect Mining

    • Working Set Recovery

In this talk, we have shown how to virtuallyremodularize code into actions using the AOIG


Questions
Questions? Program Graphs

save drawing

activate tool

update drawing

undo action

action oriented system

object oriented system


Conclusions
Conclusions Program Graphs

  • NLP

    • is sufficiently robust to use in SE tools

  • NLP + Program Analysis

    • can extract more exact information from code

    • can drive SE tools

      We have shown how to virtuallyremodularize code into actions using the AOIG


Demo of current future work
"Demo" of Current/Future Work Program Graphs

Complete Action Location Methodology

  • Form initial query (verb and DO)

  • Expand query using recommendations

    • NLP

    • Program knowledge

  • Generate "Concern Flow Graph"


Current future work
Current/Future Work Program Graphs


generate Program Graphs


PowerGrid.timePassing() Program Graphs

PowerGeneration.constructor

PowerGrid.powerSurplus

PowerGeneration.getGeneratedPower()

PowerSource.getCurrentPower()

calls

StandardPowerSource.getCurrentPower()

SolarPowerSource.getCurrentPower()

PowerSource.getCurrentPower()


UnfoldAll.foldOneStage() Program Graphs

UnfoldAll..foldStageN()

UnfoldAll..foldAll()

UnfoldAll.setFolded()

MindMapActions.setFolded()

ControllerAdapter.setFolded()

ToggleFoldedAction.setFolded()

ToggleFoldedAction.createSingleFoldAction()

FoldActionType.setFolded()

NodeAction.setNode()

FoldActionTypeImple.setFolded()

NodeActionImple.setNode()


Initial conclusions of current work
Initial Conclusions of Current Work Program Graphs

  • Actions often appear as CCs in real code

  • Semantic queries over language clues can find actions

    • helps with mapping

  • Result sets

    • easier to understand when presented as graph


User feedback
User Feedback Program Graphs

DIRECTIONS:

  • Place asparagus and onion in a saucepan with 1/2 cup vegetable broth. Bring the broth to a boil, reduce heat and let simmer until the vegetables are tender.

  • Reserve a few asparagus tips for garnish. Place remaining vegetable mixture in an electric blender and puree until smooth.

  • Melt butter in the pan that was used for simmering the asparagus and onions. Stir while sprinkling flour, salt, and pepper into the butter. Do not let the flour brown. Allow the mixture to cook only 2 minutes. Stir in remaining 1 1/4 cups vegetable broth and increase the heat. Continue stirring until the mixture comes to a boil.

  • Stir the vegetable puree and milk into the saucepan. Whisk yogurt into the mixture, followed by lemon juice. Stir until heated through, then ladle into bowls. Garnish with reserved asparagus tips. Sprinkle with Parmesan cheese if desired.

Something goes wrong when I am sprinkling things into the butter.


Recipe developer fix it
Recipe Developer, Fix it Program Graphs


Recipe storage system 2 0
Recipe Storage System: 2.0 Program Graphs

more complex system, actions are scattered further

Onion

place(Pan p)

Person

place(List ingredients, Pan p)

Placeable

place(Pan p)

Vegetable

place(Pan p)

Pepper

place(Pan p)

Beef

place(Pan p)


Clever worker
Clever Worker Program Graphs

  • 1 pound fresh asparagus

    • Place asparagus in a saucepan.

    • Reserve a few asparagus tips for garnish

    • Garnish with reserved asparagus tips.

2 tablespoons all-purpose flour

1.

2.

3. Sprinkle flour into the butter. Do not let the flour brown.

1 tablespoons butter

1.

2.

3. Melt butter in the pan that was used for simmering the asparagus and onions…stir.

1 teaspoon salt

1.

2.

3. Sprinkle salt into the butter.

1/2 cup yogurt

1.

2.

3.

4. Whisk yogurt into the mixture

1 cup soy milk

1

2.

3. Stir the milk into the saucepan.


Person Program Graphs

sprinkleItems(List ingredients)


Clever worker1
Clever Worker Program Graphs

  • 1 pound fresh asparagus

    • Place asparagus in a saucepan.

    • Reserve a few asparagus tips for garnish

    • Garnish with reserved asparagus tips.

2 tablespoons all-purpose flour

1.

2.

3. Sprinkle flour into the butter. Do not let the flour brown.

1 tablespoons butter

1.

2.

3. Melt butter in the pan that was used for simmering the asparagus and onions…stir.

1 teaspoon salt

1.

2.

3. Sprinkle salt into the butter.

1/2 cup yogurt

1.

2.

3.

4. Whisk yogurt into the mixture

1 cup soy milk

1

2.

3. Stir the milk into the saucepan.


ad