This document discusses modeling software history and evolution. It presents several techniques for visualizing and analyzing changes in software over time, including matrices to show class evolution, metrics to detect design flaws, and strategies that consider historical context. Evolution information can provide insights into patterns of change, but modeling history poses challenges due to the large amount of data involved.
2. Modeling History
to Understand Software Evolution
Inauguraldissertation der
Philosophisch-naturwissenschaftlichen
Fakultät der Universität Bern
vorgelegt von
Tudor Gîrba
von Rumänien
Leiter der Arbeit:
Prof. Dr. Stéphane Ducasse
Prof. Dr. Oscar Nierstrasz
Institut für Informatik und
angewandte Mathematik
14. sh
ort
int
er
me
zzo
A model is a simplification of the subject,
and its purpose is to answer some particular
questions aimed towards the subject.
Bezivin, Gerbe, 2001
19. Eick etal, 2002
es?
niqu
tech
Lehman etal, 2001 ese
ll th
da te a
om mo
we acc
can
ow
H
...
Lanza, Ducasse, 2002
Gall etal, 2003
20. Evolution Matrix shows class changes.
Lanza, Ducasse, 2004
Idle
class
Pulsar
class
Supernova
class
attributes
White dwarf
class methods Class
21. Evolution Matrix shows class changes.
Lanza, Ducasse, 2004
Idle
class
Pulsar
class
Supernova
class
attributes
White dwarf
class methods Class
22. Evolution Matrix shows class changes.
Lanza, Ducasse, 2004
Idle
class
entity.
st c lass
Pulsar
da s fir
class
mo dele
to be
needs
Supernova tio n
class Evolu
attributes
White dwarf
class methods Class
23. Evolution Matrix shows class changes.
Lanza, Ducasse, 2004
Idle
class
Pulsar
class
Supernova
class
attributes
White dwarf
class methods Class
24. Evolution Matrix shows class changes.
Idle
class history
Pulsar
class history
Supernova
class history
ClassHistory
White dwarf isPulsar
class history isIdle
...
36. ENOM LENOM EENOM
balanced changer 7 3.5 3.25
late changer 7 5.75 1.37
3 1 2
dead stable 0 0 0
early changer 7 1.25 5.25
37. ENOM LENOM EENOM
balanced changer 7 3.5 3.25
late changer 7 tity 5.75 nts. 1.37
en ureme
lass eas
st c gh m
s fir rou 3
y a th 1 2
r
H isto rison
co mpa
deadsstable
ena ble 0 0 0
early changer 7 1.25 5.25
38. History can be measured in many ways.
Evolution Number of Methods
Stability Number of Lines of Code
Historical Max of Cyclomatic Complexity
Growth Trend Number of Modules
... ...
51. past future
YesterdayWeatherHit(present):
past:=histories.topLENOM(start, present)
future:=histories.topEENOM(present, end)
past.intersectWith(future).notEmpty()
prediction hit present
52. 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%
54. Detection Strategies are metric-based queries to
detect design flaws. Lanza, Marinescu 2006
Rule 1
METRIC 1 > Threshold 1
AND Quality problem
Rule 2
METRIC 2 < Threshold 2
55. Example: a God Class centralizes too much
intelligence in the system.
Class uses directly more than a
few attributes of other classes
ATFD > FEW
Functional complexity of the
class is very high
AND GodClass
WMC ! VERY HIGH
Class cohesion is low
TCC < ONE THIRD
56. Example: a God Class centralizes too much
intelligence in the system.
Class uses directly more than a
few attributes of other classes
ATFD > FEW
tab le?
f it is s
wh
Functional complexity of the at i
ut,
class is very high
B AND GodClass
WMC ! VERY HIGH
Class cohesion is low
TCC < ONE THIRD
57. History-based Detection Strategies take evolution
into account. Ratiu etal, 2004
God Class
in the last version
isGodClass(last)
AND Harmless God Class
Stable throughout
the history
Stability > 90%
58. History-based Detection Strategies take evolution
into account. Ratiu etal, 2004
me.
God Class
in the last version
sa
ed the
isGodClass(last)
eat
e tr
pace ar
an ds AND Harmless God Class
e
Tim
Stable throughout
the history
Stability > 90%
60. What happens with inheritance?
A A A A A
B C B C B C B B
D D D E
ver .1 ver. 2 ver. 3 ver. 4 ver. 5
61. History contains too much data.
A A A A A A A A A A A A A A A A A A A A
B C B C B C B B B C B C B C B B B C B C B C B B B C B C B C B B
D D D E D D D E D D D E D D D E
ver .1 ver. 2 ver. 3 ver. 4 ver. 5 ver .1 ver. 2 ver. 3 ver. 4 ver. 5 ver .1 ver. 2 ver. 3 ver. 4 ver. 5 ver .1 ver. 2 ver. 3 ver. 4 ver. 5
A A A A A A A A A A A A A A A A A A A A
B C B C B C B B B C B C B C B B B C B C B C B B B C B C B C B B
D D D E D D D E D D D E D D D E
ver .1 ver. 2 ver. 3 ver. 4 ver. 5 ver .1 ver. 2 ver. 3 ver. 4 ver. 5 ver .1 ver. 2 ver. 3 ver. 4 ver. 5 ver .1 ver. 2 ver. 3 ver. 4 ver. 5
A A A A A A A A A A A A A A A A A A A A
B C B C B C B B B C B C B C B B B C B C B C B B B C B C B C B B
D D D E D D D E D D D E D D D E
ver .1 ver. 2 ver. 3 ver. 4 ver. 5 ver .1 ver. 2 ver. 3 ver. 4 ver. 5 ver .1 ver. 2 ver. 3 ver. 4 ver. 5 ver .1 ver. 2 ver. 3 ver. 4 ver. 5
A A A A A A A A A A A A A A A A A A A A
B C B C B C B B B C B C B C B B B C B C B C B B B C B C B C B B
D D D E D D D E D D D E D D D E
ver .1 ver. 2 ver. 3 ver. 4 ver. 5 ver .1 ver. 2 ver. 3 ver. 4 ver. 5 ver .1 ver. 2 ver. 3 ver. 4 ver. 5 ver .1 ver. 2 ver. 3 ver. 4 ver. 5
62. System System
History Version
Class Class
History Version
63. System System
History Version
Inheritance
Version
Class Class
History Version
64. System System
History Version
Inheritance Inheritance
History Version
Class Class
History Version
65. A A A A A
B C B C B C B B
D D D E
ver .1 ver. 2 ver. 3 ver. 4 ver. 5
A is persistent, B is stable, C was removed, E is newborn ...
66. Hierarchy Evolution View encapsulates time.
Girba etal, 2005
A
changed
methods
changed
age
lines
C B
Removed
Removed
D E
A is persistent, B is stable, C was removed, E is newborn ...
80. {A, B, C, D, E}
1 2 3 4 5 6 Ø
A {A, D, B} {A, E, C, D}
{2} {6}
B
{D, B} {A, D} {A, E, C}
C FCA
{2, 4} {2, 6} {5, 6}
D
{D} {A} {C}
E {2, 4, 6} {2, 5, 6} {3, 5, 6}
Ø
{1, 2, 3, 4, 5, 6}
81. {A, B, C, D, E}
1 2 3 4 5 6 Ø
A {A, D, B} {A, E, C, D}
{2} {6}
tity
B
s en A.
st clas {D, B}
FC
firFCA g to{2, 4} {A, D} {A, E, C}
y as appin
C {2, 6} {5, 6}
stor s m
Hi ble
D
ena {D} {A} {C}
E {2, 4, 6} {2, 5, 6} {3, 5, 6}
Ø
{1, 2, 3, 4, 5, 6}
90. Ownership Map reveals development patterns.
Girba etal, 2006
tity anges.
s en c ch
clas listi
rst ho
as fi out
tory ing ab
His son
les rea
enab
91. Measuring Yesterday’s Time-based
history Weather Detection Strategies
1 2 3
4 5 6
Visualizing the evolution Detecting How developers
of hierarchies co-change patterns drive evolution
92. System System
History Version
Inheritance Inheritance
History Version
Class Class
History Version
93. History Version
History Version
History Version
94. History Version
en tity.
st c lass 200
5
as fir Gir ba,
his tory History Version
mo dels
Hi smo
History Version
95. Modeling History
to Understand Software Evolution
Inauguraldissertation der
Philosophisch-naturwissenschaftlichen
Fakultät der Universität Bern
vorgelegt von
Tudor Gîrba
von Rumänien
Leiter der Arbeit:
Prof. Dr. Stéphane Ducasse
Prof. Dr. Oscar Nierstrasz
Institut für Informatik und
angewandte Mathematik
www.tudorgirba.com