Towards supporting on demand virtual remodularization using program graphs
This presentation is the property of its rightful owner.
Sponsored Links
1 / 53

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


  • 40 Views
  • Uploaded on
  • Presentation posted in: General

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.

Download Presentation

Towards Supporting On-Demand Virtual Remodularization Using Program Graphs

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

//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

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

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

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

Recipe Writing System 1.0


Choosing a dominant decomposition1

Choosing a Dominant Decomposition

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

  • 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

//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 Actions

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 actions in a noun's world?

Our Strategy

  • Extract natural language clues

  • Query clues and remodularize


Towards supporting on demand virtual remodularization using program graphs

Extract 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


Towards supporting on demand virtual remodularization using program graphs

Query 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!


A closer look at the extraction process

A Closer Look at the Extraction Process...


What to extract

What to Extract

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

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 Comments

  • 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

  • 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

  • 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

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

  • 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

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

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?

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 AOIGper 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...


Action oriented view

Action-Oriented View

  • 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 (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?

save drawing

activate tool

update drawing

undo action

action oriented system

object oriented system


Conclusions

Conclusions

  • 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

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


Towards supporting on demand virtual remodularization using program graphs

generate


Towards supporting on demand virtual remodularization using program graphs

PowerGrid.timePassing()

PowerGeneration.constructor

PowerGrid.powerSurplus

PowerGeneration.getGeneratedPower()

PowerSource.getCurrentPower()

calls

StandardPowerSource.getCurrentPower()

SolarPowerSource.getCurrentPower()

PowerSource.getCurrentPower()


Towards supporting on demand virtual remodularization using program graphs

UnfoldAll.foldOneStage()

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

  • 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

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


Recipe storage system 2 0

Recipe Storage System: 2.0

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

  • 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.


Towards supporting on demand virtual remodularization using program graphs

Person

sprinkleItems(List ingredients)


Clever worker1

Clever Worker

  • 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.


  • Login