Vous êtes sur la page 1sur 22

JQuery: Finding your way through scattered code

Andrew Eisenberg, Doug Janzen, Kris De Volder, Ryan Wannop

Software Practices Lab. -- The University of British Columbia

JQuery: Motivation
Typical ways to explore scattered concerns:
Browse structural views
package structures, inheritance hierarchy regular expressions calls, instantiates, references

Search for a specific pattern Follow relationships

Most modern IDEs can help with all of this, but

Software Practices Lab. -- The University of British Columbia

JQuery: Motivation
Explosion of browsers
Browsers are too specific
Poor use of screen RealEstate Exploration itself is scattered and tangled
Package Explorer Search Call Hierarchy Inheritance Hierarchy

Software Practices Lab. -- The University of British Columbia

JQuery: How it works


Avoiding loss of context:
Problem: Too many browsers leads to loss of context. Solution: Support many views within a New Choose Browser single tool.

Start with Package Browser

Software Practices Lab. -- The University of British Columbia

JQuery: How it works

Both views in same window

Abstract Class Browser

Bundled with many more browsers

Package Browser

Software Practices Lab. -- The University of British Columbia

JQuery: How it works


Incrementally perform the exploration by extending each view with a sub-view
1. Select extension point

Software Practices Lab. -- The University of British Columbia

JQuery: How it works


Incrementally perform the exploration by extending views with a new extensions
1. Select extension point 2. Choose subquery

Software Practices Lab. -- The University of British Columbia

JQuery: How it works


Incrementally perform the exploration by extending views with a new extensions
1. Select extension point 2. Choose subquery 3. Continue exploration

Bundled with many more sub-browsers


Software Practices Lab. -- The University of British Columbia
8

JQuery: How it works


Filtering by regular expression
Search for Figure: Open query dialog double-click

Software Practices Lab. -- The University of British Columbia

JQuery: How it works


Filtering by regular expression
Search for Figure: Open query dialog Edit query

Software Practices Lab. -- The University of British Columbia

10

JQuery: How it works


Filtering by regular expression
Search for Figure: Open query dialog Edit query Close dialogue (query automatically reexecutes)

Software Practices Lab. -- The University of British Columbia

11

JQuery: How it works


Filtering by regular expression
Browser is now filtered by Figure

Can customize queries in many other ways too.

Software Practices Lab. -- The University of British Columbia

12

JQuery: An Example
Task:
Make a enhancement to the JHotDraw codebase. Nontrivial, but some details abstracted away. Based on an actual task we performed with little prior knowledge of the codebase.

Software Practices Lab. -- The University of British Columbia

13

JQuery: The Plan


Menu Change Pen Color

???

Frame
Rectangle

No Frame
Text
14

Software Practices Lab. -- The University of British Columbia

JQuery: Executing the Plan


Menu Change Pen Color

???
Change Attribute Command

Step 1: Find menu creation

Found by regex search for *Attribute*

Step 2: Find relationship to frames

???

Frame
Rectangle

No Frame
Text
15

Software Practices Lab. -- The University of British Columbia

JQuery: Executing the Plan


creates

Draw Application

createColorMenu

calls

createAttrMenu

Change Attribute execute Command

Determined that Pen Color sets Menu FrameColor Attribute

???

Frame
Rectangle

No Frame
Text
16

Software Practices Lab. -- The University of British Columbia

JQuery: Executing the Plan


creates

Draw Application

createColorMenu

calls

createAttrMenu

Change Attribute execute Command Figure


setAttr

calls

Determined that Pen Color sets FrameColor Attribute sidetrack to explore FigureAttributes Frame
Rectangle

implemented by

setAttr

Attribute Figure

getAttr drawFr

dataflow

No Frame
Text
17

Software Practices Lab. -- The University of British Columbia

JQuery: Executing the Plan


creates

Draw Application

createColorMenu

calls

createAttrMenu

Change Attribute execute Command Figure


setAttr

calls

Determined that Pen Color sets FrameColor Attribute sidetrack to explore FigureAttributes

implemented by change this method

setAttr

Attribute Figure

getAttr drawFr

dataflow

implemented by

Rectangle Figure

drawFr

Text Figure

drawFr

Software Practices Lab. -- The University of British Columbia

18

JQuery: Versatile Code Navigator


Browse Scattered Code 1. Browsing structural views 2. Searching for a specific pattern 3. Following relationships Current IDEs: explosion of disconnected views loss of context disorientation JQuery: within a single navigation view retain context reduce disorientation
19

Software Practices Lab. -- The University of British Columbia

JQuery: Customization
JQuery can do more:
can create more powerful queries can include data from other tools has extendable menu items virtual source files (in next release) See our website!

Software Practices Lab. -- The University of British Columbia

20

JQuery: De-tangling searching


Why use 4 browsers when you can use 1?

Software Practices Lab. -- The University of British Columbia

21

Questions?
Download JQuery (new release out soon): Google:
Prevents tangled and scattered searches Reduces disorientation of complex exploration Maintains context
Andrew Eisenberg: ade@cs.ubc.ca

Software Practices Lab. -- The University of British Columbia

22

Vous aimerez peut-être aussi