Upload
tudor-girba
View
3.075
Download
2
Embed Size (px)
DESCRIPTION
Over the past three decades, more and more research has been spent on understanding software evolution. However, the approaches developed so far rely on ad-hoc models, or on too specific meta-models, and thus, it is difficult to reuse or compare their results. We argue for the need of an explicit and generic meta-model that recognizes evolution as an explicit phenomenon and models it as a first class entity. Our solution is to encapsulate the evolution in the explicit notion of history as a sequence of versions, and to build a meta-model around these notions called Hismo. To show the usefulness of our meta-model we exercise its different characteristics by building several reverse engineering applications.
Citation preview
Modeling Historyto Understand Software Evolution
Tudor Gîrbawww.tudorgirba.com
to Understand Software Evolution
Modeling History
vorgelegt von
Tudor Gîrba
von Rumänien
Inauguraldissertation der Philosophisch-naturwissenschaftlichen
Fakultät der Universität Bern
Leiter der Arbeit:
Prof. Dr. Stéphane DucasseProf. Dr. Oscar Nierstrasz
Institut für Informatik und angewandte Mathematik
forward engineering
}
{
}
{
}
{
}
{
forward engineering
actual development }
{
}
{
}
{
}
{}
{
}
{
}
{}
{
}
{
reve
rse
engin
eerin
gforward engineering
}
{
}
{
}
{
}
{}
{
}
{
}
{}
{
}
{
actual development
reve
rse
engin
eerin
gforward engineering
}
{
}
{
}
{
}
{}
{
}
{
}
{}
{
}
{
actual development
reve
rse
engi
neer
ing
Lehman etal, 2001
Most often time is put on the horizontaland a property on the vertical axis.
Lanza, Ducasse, 2002
Evolution Matrix shows how classes evolve.Time is still on the horizontal axis.
Gall etal, 2003
Co-change analysis recovers hidden dependencies.Time is the lines.
Eick etal, 2002
Evolution information can bemapped on structural information.
Lehman etal, 2001
Eick etal, 2002
Lanza, Ducasse, 2002Gall etal, 2003
...
Lehman etal, 2001
Eick etal, 2002
Lanza, Ducasse, 2002Gall etal, 2003
...How can we accommodate all t
hese techniques?
short intermezzo
What is a model?
short intermezzoA model is a simplification of the subject,
and its purpose is to answer some particular
questions aimed towards the subject.
Bezivin, Gerbe, 2001
short intermezzo
what is a meta-model?
short intermezzoa meta-model isa model that makes statements aboutwhat can be expressed in valid models.
Seidewitz, 2003
short intermezzoa good meta-modelallows for succinctexpression of analyses.
Lehman etal, 2001
Eick etal, 2002
Lanza, Ducasse, 2002Gall etal, 2003
...
Lehman etal, 2001
Eick etal, 2002
Lanza, Ducasse, 2002Gall etal, 2003
...How can we accommodate all t
hese techniques?
Evolution Matrix shows class changes.
Idleclass
Pulsarclass
Supernovaclass
White dwarfclass Class
attributes
methods
Lanza, Ducasse, 2004
Evolution Matrix shows class changes.
Idleclass
Pulsarclass
Supernovaclass
White dwarfclass Class
attributes
methods
Lanza, Ducasse, 2004
Evolution Matrix shows class changes.
Idleclass
Pulsarclass
Supernovaclass
White dwarfclass Class
attributes
methods
Evolution needs to be modeled as first c
lass entity.
Lanza, Ducasse, 2004
Evolution Matrix shows class changes.
Idleclass
Pulsarclass
Supernovaclass
White dwarfclass Class
attributes
methods
Lanza, Ducasse, 2004
Evolution Matrix shows class changes.
Idleclass history
Pulsarclass history
Supernovaclass history
White dwarfclass history
ClassHistory
isPulsarisIdle...
ClassVersion
SystemVersion
ClassVersion
ClassHistory
SystemVersion
ClassVersion
ClassHistory
SystemVersion
SystemHistory
ClassVersion
ClassHistory
SystemVersion
SystemHistory
ClassVersion
ClassHistory
SystemVersion
SystemHistory
Hismo models history as first c
lass entity.
Girba, 2005
1 2 3
4 5 6
Measuringhistory
Yesterday’sWeather
Time-basedDetection Strategies
Visualizing the evolution of hierarchies
Detectingco-change patterns
How developersdrive evolution
1Measuring history
2 4 3 5 7
2 2 3 4 9
2 2 1 2 3
2 2 2 2 2
1 5 3 4 4
What changed? When did it change? ...
1 5 3 4 4
4 2 1 0+++ = 7=
LENOM(C) = ∑ |NOMi(C)-NOMi-1(C)| 2i-nEvolution ofNumber of Methods
LENOM(C)
1 5 3 4 4
LENOM(C) = ∑ |NOMi(C)-NOMi-1(C)| 2i-n
LENOM(C) 4 2-3 2 2-2 1 2-1 0 20+++ = 1.5=
EENOM(C) = ∑ |NOMi(C)-NOMi-1(C)| 22-i
Latest Evolution ofNumber of Methods
Earliest Evolution ofNumber of Methods
EENOM(C) 4 20 2 2-1 1 2-2 0 2-3+++ = 5.25=
ENOM LENOM EENOM
7 3.5 3.25
7 5.75 1.37
3 1 2
0 0 0
7 1.25 5.25
2 4 3 5 7
2 2 3 4 9
2 2 1 2 3
2 2 2 2 2
1 5 3 4 4
ENOM LENOM EENOM
7 3.5 3.25
7 5.75 1.37
3 1 2
0 0 0
7 1.25 5.25
balanced changer
late changer
dead stable
early changer
ENOM LENOM EENOM
7 3.5 3.25
7 5.75 1.37
3 1 2
0 0 0
7 1.25 5.25
balanced changer
late changer
dead stable
early changer
History as first c
lass entity
enables comparison through measurements.
Evolution
Stability
Historical Max
Growth Trend
...
Number of Methods
Number of Lines of Code
Cyclomatic Complexity
Number of Modules
...
of
History can be measured in many ways.
2Yesterday’s weather
The recently changed parts are likely to change in the near future.
Common wisdom
The recently changed parts are likely to change in the near future.
Common wisdom
Are they really?
30% 90%
present
present
past
present
past future
present
past future
present
past future
present
past future
prediction hit
present
past future
YesterdayWeatherHit(present):
past:=histories.topLENOM(start, present) future:=histories.topEENOM(present, end)
past.intersectWith(future).notEmpty()
prediction hit
Overall Yesterday’s Weather shows the localization of changed in time. Girba etal, 2004
hit hit hit
YW = 3 / 8 = 37%
hit hit hit hit hit hit hit
YW = 7 / 8 = 87%
3Time-based Detection Strategies
Detection Strategies are metric-based queries to detect design flaws.
METRIC 1 > Threshold 1
Rule 1
METRIC 2 < Threshold 2
Rule 2
AND Quality problem
Lanza, Marinescu 2006
Example: a God Class centralizes too much intelligence in the system.
ATFD > FEW
Class uses directly more than a
few attributes of other classes
WMC ! VERY HIGH
Functional complexity of the
class is very high
TCC < ONE THIRD
Class cohesion is low
AND GodClass
Lanza, Marinescu, 2006
Example: a God Class centralizes too much intelligence in the system.
ATFD > FEW
Class uses directly more than a
few attributes of other classes
WMC ! VERY HIGH
Functional complexity of the
class is very high
TCC < ONE THIRD
Class cohesion is low
AND GodClass
Lanza, Marinescu, 2006
But, what if it is
stable?
History-based Detection Strategies take evolution into account. Ratiu etal, 2004
AND
isGodClass(last)
God Class
in the last version
Stability > 90%
Stable throughout
the history
Harmless God Class
History-based Detection Strategies take evolution into account. Ratiu etal, 2004
AND
isGodClass(last)
God Class
in the last version
Stability > 90%
Stable throughout
the history
Harmless God Class
Time and space are treated the same.
4Visualizing the evolution of hierarchies
What happens with inheritance?
ver .1 ver. 2 ver. 3 ver. 4 ver. 5
A A A A A
B B B B BC C C
D D D E
History contains too much data.
ver .1 ver. 2 ver. 3 ver. 4 ver. 5
A A A A A
B B B B BC C C
D D D E
ver .1 ver. 2 ver. 3 ver. 4 ver. 5
A A A A A
B B B B BC C C
D D D E
ver .1 ver. 2 ver. 3 ver. 4 ver. 5
A A A A A
B B B B BC C C
D D D E
ver .1 ver. 2 ver. 3 ver. 4 ver. 5
A A A A A
B B B B BC C C
D D D E
ver .1 ver. 2 ver. 3 ver. 4 ver. 5
A A A A A
B B B B BC C C
D D D E
ver .1 ver. 2 ver. 3 ver. 4 ver. 5
A A A A A
B B B B BC C C
D D D E
ver .1 ver. 2 ver. 3 ver. 4 ver. 5
A A A A A
B B B B BC C C
D D D E
ver .1 ver. 2 ver. 3 ver. 4 ver. 5
A A A A A
B B B B BC C C
D D D E
ver .1 ver. 2 ver. 3 ver. 4 ver. 5
A A A A A
B B B B BC C C
D D D E
ver .1 ver. 2 ver. 3 ver. 4 ver. 5
A A A A A
B B B B BC C C
D D D E
ver .1 ver. 2 ver. 3 ver. 4 ver. 5
A A A A A
B B B B BC C C
D D D E
ver .1 ver. 2 ver. 3 ver. 4 ver. 5
A A A A A
B B B B BC C C
D D D E
ver .1 ver. 2 ver. 3 ver. 4 ver. 5
A A A A A
B B B B BC C C
D D D E
ver .1 ver. 2 ver. 3 ver. 4 ver. 5
A A A A A
B B B B BC C C
D D D E
ver .1 ver. 2 ver. 3 ver. 4 ver. 5
A A A A A
B B B B BC C C
D D D E
ver .1 ver. 2 ver. 3 ver. 4 ver. 5
A A A A A
B B B B BC C C
D D D E
ClassVersion
ClassHistory
SystemVersion
SystemHistory
ClassVersion
ClassHistory
SystemVersion
SystemHistory
InheritanceVersion
InheritanceHistory
ClassVersion
ClassHistory
SystemVersion
SystemHistory
InheritanceVersion
ver .1 ver. 2 ver. 3 ver. 4 ver. 5
A A A A A
B B B B BC C C
D D D E
A is persistent, B is stable, C was removed, E is newborn ...
Hierarchy Evolution View encapsulates time.
A
B
D
C
E
A is persistent, B is stable, C was removed, E is newborn ...
age
changedmethods
changedlines
Removed
Removed
Girba etal, 2005
Hierarchy Evolution View reveals patterns.Girba etal, 2005
Hierarchy Evolution View reveals patterns.Girba etal, 2005
History as first c
lass entity
enables mapping to a graph.
5Identifying co-change patterns
A
B
C
D
E
1 2 3 4 5 6
B E
C D
A
Gall etal, ‘98
Co-change patterns are n-ary relationships.
A
B
C
D
E
1 2 3 4 5 6
Version
A
B
C
D
E
1 2 3 4 5 6
changed
Version
changed(i)
HistoryA
B
C
D
E
1 2 3 4 5 6
changed
Version
What is Concept Analysis?
A
B
C
D
E
1 2 3 4 5 6
{A, B, C, D, E}
Ø
{D, B}{2, 4}
{A, D}{2, 6}
{A, E, C}{5, 6}
{A, D, B}{2}
{A, E, C, D}{6}
{D}{2, 4, 6}
{A}{2, 5, 6}
{C}{3, 5, 6}
Ø{1, 2, 3, 4, 5, 6}
FCA
A
B
C
D
E
1 2 3 4 5 6
{A, B, C, D, E}
Ø
{D, B}{2, 4}
{A, D}{2, 6}
{A, E, C}{5, 6}
{A, D, B}{2}
{A, E, C, D}{6}
{D}{2, 4, 6}
{A}{2, 5, 6}
{C}{3, 5, 6}
Ø{1, 2, 3, 4, 5, 6}
FCA
A
B
C
D
E
1 2 3 4 5 6
Girba etal, 2007
Parallel Inheritanceadd simultaneously children to several classes
Shotgun Surgerychange several classes simultaneously, but do not add methods
{A, B, C, D, E}
Ø
{D, B}{2, 4}
{A, D}{2, 6}
{A, E, C}{5, 6}
{A, D, B}{2}
{A, E, C, D}{6}
{D}{2, 4, 6}
{A}{2, 5, 6}
{C}{3, 5, 6}
Ø{1, 2, 3, 4, 5, 6}
FCA
A
B
C
D
E
1 2 3 4 5 6
{A, B, C, D, E}
Ø
{D, B}{2, 4}
{A, D}{2, 6}
{A, E, C}{5, 6}
{A, D, B}{2}
{A, E, C, D}{6}
{D}{2, 4, 6}
{A}{2, 5, 6}
{C}{3, 5, 6}
Ø{1, 2, 3, 4, 5, 6}
FCA
A
B
C
D
E
1 2 3 4 5 6
History as first c
lass entity
enables mapping to FCA.
6How developers drive software evolution
CVS shows activity.
Who is responsible for this?
Who is responsible for this?
Alphabetical order is no order.
The Hausdorf metric can be used to compute the similarity between commits.
A
B
d(A, B) = ∑ min2{ | a - b | b in B }a in A
Alphabetical order is no order.
Ownership Map reveals development patterns.Girba etal, 2006
Ownership Map reveals development patterns.Girba etal, 2006
History as first c
lass entity
enables reasoning about holistic changes.
1 2 3
4 5 6
Measuringhistory
Yesterday’sWeather
Time-basedDetection Strategies
Visualizing the evolution of hierarchies
Detectingco-change patterns
How developersdrive evolution
InheritanceHistory
ClassVersion
ClassHistory
SystemVersion
SystemHistory
InheritanceVersion
History
VersionHistory
VersionHistory
Version
History
VersionHistory
VersionHistory
Version
Hismo models history as first c
lass entity.
Girba, 2005
to Understand Software Evolution
Modeling History
vorgelegt von
Tudor Gîrba
von Rumänien
Inauguraldissertation der Philosophisch-naturwissenschaftlichen
Fakultät der Universität Bern
Leiter der Arbeit:
Prof. Dr. Stéphane DucasseProf. Dr. Oscar Nierstrasz
Institut für Informatik und angewandte Mathematik
www.tudorgirba.com
Tudor Gîrbawww.tudorgirba.com
creativecommons.org/licenses/by/3.0/