Program understanding: What programmers really want
Click here to load reader
-
Upload
einar-host -
Category
Technology
-
view
568 -
download
0
Transcript of Program understanding: What programmers really want
![Page 1: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/1.jpg)
Program Understanding:What Programmers Really Want
Einar W. HøstMay 5th 2011
![Page 2: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/2.jpg)
Evaluation Examples
DescriptionIntroduction
Consider Limitations of Current Tools
Look at somewell-known
Analyses
How Analysis can help
Understanding
Understanding Program
Understanding
AgendaAgenda
![Page 3: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/3.jpg)
Program Analysis
Program Analysis
Program Understanding
![Page 4: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/4.jpg)
Why is program understanding important?
![Page 5: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/5.jpg)
It’s what programmers do!
![Page 6: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/6.jpg)
“To program is to understand” - Kristen Nygaard
![Page 7: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/7.jpg)
Why is program understanding hard?
![Page 8: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/8.jpg)
Size.
![Page 9: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/9.jpg)
Complexity.
![Page 10: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/10.jpg)
Heterogenity.
![Page 11: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/11.jpg)
Side-effects.
![Page 12: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/12.jpg)
The concept assignment problem.
![Page 13: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/13.jpg)
Intangibility.
![Page 14: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/14.jpg)
=>
![Page 15: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/15.jpg)
Disorientation.
![Page 16: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/16.jpg)
“Few are the programmers who can explain their code well enough so that reading it is not incredibly frustrating.” - Jef Raskin
![Page 17: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/17.jpg)
How can program analysis help?
![Page 18: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/18.jpg)
$s.=($f=$ARGV[$_%2])x(substr$s,$_,1or$f)for0..500;
Program Understanding
?
![Page 19: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/19.jpg)
Program Understanding
!
Through the magic lens of a Tool
$s.=($f=$ARGV[$_%2])x(substr$s,$_,1or$f)for0..500;
![Page 20: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/20.jpg)
What do programmers want?
![Page 21: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/21.jpg)
”Help me in finding what needs to be changed...
![Page 22: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/22.jpg)
...make the change...
![Page 23: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/23.jpg)
...and get the !$&?/% out!”
![Page 24: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/24.jpg)
Just-in-time program understanding.
![Page 25: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/25.jpg)
Complete understanding is
- Not realistic- Not cost-effective- Not necessary
![Page 26: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/26.jpg)
Understand the program well enough to
implement a new feature
![Page 27: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/27.jpg)
Understand the program well enough to
fix a bug
![Page 28: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/28.jpg)
Understand the program well enough to
improve performance
![Page 29: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/29.jpg)
Without change, there is no need for understanding!
![Page 30: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/30.jpg)
Program understanding
- Understanding execution behavior- Understanding control flow- Understanding data flow- Understanding dependencies- Understanding side-effects- Understanding change impact- Reasoning about design
at the code level
![Page 31: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/31.jpg)
Program understanding
- Understanding what is relevant
at the task level
![Page 32: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/32.jpg)
Comprehension strategies
![Page 33: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/33.jpg)
Comprehension strategies
Top-down
Reconstruct knowledge about the program domain and mapping it to the source code.
![Page 34: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/34.jpg)
Comprehension strategies
Bottom-up
Read code statements and mentally group these statements into higher level abstractions.
![Page 35: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/35.jpg)
Comprehension strategies
Systematic
Read code in detail,follow control flow,gain global understanding.
![Page 36: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/36.jpg)
Comprehension strategies
Opportunistic
Scan code, looking for clues indicating relevance to the task at hand.
![Page 37: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/37.jpg)
Comprehension strategies
Inquiries
conjecture
read
searchquestion
![Page 38: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/38.jpg)
Comprehension strategies
Integrated
Understanding is formed by switching between different strategies as needed.
![Page 39: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/39.jpg)
Tools for program understanding
![Page 40: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/40.jpg)
Presentation
Analysis
![Page 41: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/41.jpg)
Analysis tools
- Call graphs- Program slicing- Feature location- Effects of change- Software metrics
![Page 42: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/42.jpg)
Presentation tools
- Visualisations- Context-awareness
![Page 43: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/43.jpg)
What is a program?
![Page 44: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/44.jpg)
print ”This is not a program.”
![Page 45: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/45.jpg)
print(”This is not a program.”)
![Page 46: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/46.jpg)
The program as
text
![Page 47: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/47.jpg)
The program as
binary
![Page 48: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/48.jpg)
The program as
versioned
![Page 49: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/49.jpg)
The program as
process
![Page 50: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/50.jpg)
The program ecosystem
- Source code / Compiled binary- Execution environment (runtime)- Test suite - Version control system- Issue tracking system- Integrated development environment- The programmer- External sources
![Page 51: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/51.jpg)
What questions can we ask about a program?
![Page 52: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/52.jpg)
Behavior-centric
- What does this piece of code do? - What happens if I change this?- Where is this code used?- Which parts of the program are affected by change?
Requires program code
![Page 53: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/53.jpg)
Evolution-centric
- Who wrote this piece of code?- Who can help me understand this?- Why was this feature implemented this way? - What are the most bug-prone parts of the program?- Where do changes happen most often?
Requires program history
![Page 54: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/54.jpg)
Interaction-centric
- How was this piece of code written?- Which tasks are hard to accomplish?- Which parts of the program are hard to change?
Requires coding-session history
![Page 55: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/55.jpg)
What is program analysis?
![Page 56: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/56.jpg)
Traditional program analysis
All you need is codeAll you need is code
All you need is code, codeCode is all you need
![Page 57: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/57.jpg)
Static
Dynamic
![Page 58: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/58.jpg)
Static
All possible executions
![Page 59: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/59.jpg)
Static
Sound+
Conservative
![Page 60: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/60.jpg)
Static
Trades precision
for soundness
![Page 61: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/61.jpg)
Sample executions
Dynamic
![Page 62: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/62.jpg)
Efficient+
Precise
Dynamic
![Page 63: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/63.jpg)
Trades completeness
forefficiency
Dynamic
![Page 64: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/64.jpg)
Static
Dynamic
Synergy
![Page 65: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/65.jpg)
Program analysis for program understanding
![Page 66: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/66.jpg)
Call graph construction
![Page 67: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/67.jpg)
Call graph construction
Essential idea
Show calling relationships between parts of a program.
![Page 68: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/68.jpg)
Call graph construction
Sample graph
main
f
g
h
![Page 69: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/69.jpg)
Call graph construction
The ideal call graph
The relation describing exactly those calls made from one entity to another in any possible execution of the program.
![Page 70: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/70.jpg)
Call graph construction
Benefit
Make the program seem less fragmented by showing the control flow links between program parts.
![Page 71: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/71.jpg)
Call graph construction
Limitation
The graph becomes too large and complex to be comprehensible.
![Page 72: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/72.jpg)
Call graph construction
”The sight of gcc's call graph frightened my students so much that they requested a different project”
- Arun Lakhotia
Limitation
![Page 73: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/73.jpg)
![Page 74: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/74.jpg)
Program slicing
![Page 75: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/75.jpg)
Program slicing
Essential idea
Find a reduced program exhibiting the same behavior of interest as the full program.
![Page 76: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/76.jpg)
Program slicing
The reduced program is called a program slice.
![Page 77: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/77.jpg)
Program slicing
x : a statement in program PV : a subset of variables in P
C = < x, V >
Slicing criterion
![Page 78: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/78.jpg)
1 begin
2 read(x,y)
3 total := 0.0
4 sum := 0.0
5 if x <= 1
6 then sum := y
7 else begin
8 read(z)
9 total := x*y
10 end
11 write(total, sum)
12 end.
1 begin
2 read(x,y)
5 if x <= 1
6 then
7 else
8 read(z)
12 end.
Criterion: <12, z>
![Page 79: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/79.jpg)
1 begin
2 read(x,y)
12 end.
Criterion: <12, x> 1 begin
2 read(x,y)
3 total := 0.0
4 sum := 0.0
5 if x <= 1
6 then sum := y
7 else begin
8 read(z)
9 total := x*y
10 end
11 write(total, sum)
12 end.
![Page 80: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/80.jpg)
Program slicing
Forward conditioning
What would the program look like if we assume an initial state satisfying C ?
![Page 81: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/81.jpg)
Program slicing
Forward conditioning
Deletes statements that will not be executed given the initial state.
![Page 82: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/82.jpg)
Program slicing
Backward conditioning
What would the program look like if we assume an eventual state satisfying C ?
![Page 83: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/83.jpg)
Program slicing
Backward conditioning
Deletes statements which cannot lead to the eventual state.
![Page 84: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/84.jpg)
Program slicing
Benefit
The reduced programis smaller.
![Page 85: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/85.jpg)
Program slicing
Limitation
The reduced programlooks foreign.
![Page 86: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/86.jpg)
Program slicing
Limitation
Hard to integrate into the programmer’s work flow.
![Page 87: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/87.jpg)
Concept analysis
![Page 88: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/88.jpg)
Concept analysis
Essential idea
Identify groupings of objects that have common attributes.
![Page 89: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/89.jpg)
Concept analysis
Formal context
O Set of objectsA Set of attributesR Relation R⊆O ×A
C = (O, A, R )
![Page 90: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/90.jpg)
Concept analysis
σ(O) = {a∈A⎮∀o∈O : (o, a)∈R}
Common attributes
O Set of objectsA Set of attributesR Relation R⊆O ×A
![Page 91: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/91.jpg)
Concept analysis
τ(A) = {o∈O⎮∀a∈A : (o, a)∈R}
Common objects
O Set of objectsA Set of attributesR Relation R⊆O ×A
![Page 92: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/92.jpg)
Concept analysis
A pair (O, A) is a conceptif A = σ(O) and O = τ(A)
Definition of concept
![Page 93: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/93.jpg)
Concept analysis
O => SubprogramsA => Features
Feature location
![Page 94: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/94.jpg)
Concept analysis
if subprogram s is invoked when feature f is invoked
Feature location
(s, f) ⊆ R
![Page 95: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/95.jpg)
Concept analysis
Benefit
Identify parts of the program relevant for a feature.
![Page 96: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/96.jpg)
Concept analysis
Benefit
Recovery of components and generation of high-level architecture views.
![Page 97: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/97.jpg)
Concept analysis
Limitation
Imperfect high-level descriptions have limited application for concrete tasks.
![Page 98: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/98.jpg)
Concept analysis
Limitation
Requires effort from the programmer, with unclear benefits.
![Page 99: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/99.jpg)
Concept analysis
Limitation
Hard to integrate into the programmer’s work flow.
![Page 100: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/100.jpg)
Change impact analysis
![Page 101: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/101.jpg)
Change impact analysis
Essential idea
Identify the potential consequences of a program change.
![Page 102: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/102.jpg)
Change impact analysis
Essential idea
Estimate what must be modified to accomplish a change of behavior.
![Page 103: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/103.jpg)
Change impact analysis
Challenges in OO languages
Subtyping and dynamic dispatch means that change impact can be non-local and unexpected.
![Page 104: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/104.jpg)
Add empty classDelete empty class
Add fieldDelete field
Add empty methodDelete empty method
Change method bodyChange method lookup
Change impact analysis
Atomic changes
![Page 105: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/105.jpg)
Change impact analysis
Benefit
Provide a boundary around the effects of a program edit.
![Page 106: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/106.jpg)
Change impact analysis
Benefit
Provide confidence that an edit does not have unexpected effects outside the boundary.
![Page 107: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/107.jpg)
Change impact analysis
Limitation
Limited by the precision of the change impact analysis.
![Page 108: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/108.jpg)
Change impact analysis
Limitation
Still need assurance that no unexpected effects occur in the impacted part of the program.
![Page 109: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/109.jpg)
Change impact analysis
Limitation
Hard to integrate into the programmer’s work flow.
![Page 110: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/110.jpg)
Program metrics
![Page 111: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/111.jpg)
Program metrics
Essential idea
Quantify aspects of the program presumed to be relevant.
![Page 112: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/112.jpg)
Program metrics
Code-centric metrics
- Lines of code- Depth of inheritance tree- Internal cohesion- Coupling to other elements- Cyclomatic complexity- Halstead complexity- ...
![Page 113: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/113.jpg)
Program metrics
Other metrics
- Test coverage- Bug density- Change rate- ...
![Page 114: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/114.jpg)
Program metrics
Benefit
Answer questions regardingprogram quality.
![Page 115: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/115.jpg)
Program metrics
Benefit
Identify potential problemareas in the program.
![Page 116: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/116.jpg)
Program metrics
Limitation
Metrics are indirectindicators of quality.
![Page 117: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/117.jpg)
Program metrics
Limitation
Task-generating, not task-solving.
![Page 118: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/118.jpg)
Software visualisation
![Page 119: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/119.jpg)
Software visualisation
Goal
Avoid overwhelming the programmer by compressing information and using graphics.
![Page 120: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/120.jpg)
Table lens
![Page 121: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/121.jpg)
Table lens
Idea
Zoom out the table layout and display cells as pixel bars scaled and colored by data values
![Page 122: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/122.jpg)
Table lens
Example
![Page 123: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/123.jpg)
Table lens
Application
Present a compact view of software metrics for program elements.
![Page 124: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/124.jpg)
Treemap
![Page 125: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/125.jpg)
Treemap
Idea
Display hierarchical data as nested rectangles.
![Page 126: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/126.jpg)
Treemap
Example
![Page 127: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/127.jpg)
Treemap
Application
Compare metric values for various program elements.
![Page 128: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/128.jpg)
Polymetric view
![Page 129: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/129.jpg)
Polymetric view
Idea
Combine several metrics for an entity into a single view, by relating a visual aspect to each metric.
![Page 130: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/130.jpg)
Polymetric view
Example
![Page 131: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/131.jpg)
Polymetric view
Application
Present a compact view of software metrics for program elements.
![Page 132: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/132.jpg)
Hierarchical edge bundles
![Page 133: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/133.jpg)
Hierarchical edge bundles
Idea
Bundle association data with structure data in a radial view.
![Page 134: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/134.jpg)
Hierarchical edge bundles
Example
![Page 135: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/135.jpg)
Hierarchical edge bundles
Application
Compact view of associations between program elements.
![Page 136: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/136.jpg)
What about task-orientedprogram understanding?
![Page 137: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/137.jpg)
The paradox of software visualisation
![Page 138: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/138.jpg)
Programmers use visualisation all the time when discussing programs informally.
![Page 139: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/139.jpg)
Computers are good at presenting information graphically.
![Page 140: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/140.jpg)
...and yet...
![Page 141: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/141.jpg)
Software visualisation tools are rarely used for everyday software development and understanding.
![Page 142: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/142.jpg)
Why?
![Page 143: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/143.jpg)
Hypothesis
Research is out of touch with reality!
![Page 144: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/144.jpg)
Claim
Software visualisationis a generic solution looking for problems.
![Page 145: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/145.jpg)
Claim
Programmers need specific solutions to specific problems.
![Page 146: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/146.jpg)
Remedy
An easy-to-use tool that lets the programmer define the problem that needs visualisation.
![Page 147: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/147.jpg)
Task-aware environments
![Page 148: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/148.jpg)
Task-aware environments
Idea
Adapt interface to reflect the task the programmer is currently working on.
![Page 149: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/149.jpg)
Task-aware environments
Details
Introduces the notion of development sessions.
![Page 150: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/150.jpg)
Task-aware environments
Details
Links development sessions to tasks.
![Page 151: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/151.jpg)
Task-aware environments
Details
Sessions can be thrown away or saved for later.
![Page 152: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/152.jpg)
Code bubbles
![Page 153: Program understanding: What programmers really want](https://reader037.fdocuments.in/reader037/viewer/2022100300/55840331d8b42a79268b4a61/html5/thumbnails/153.jpg)
Evaluation Examples
DescriptionIntroduction
Consider Limitations of Current Tools
Look at somewell-known
Analyses
How Analysis can help
Understanding
Understanding Program
Understanding
AgendaSummary