What history can tell us

73
what history can tell us Tudor Gîrba www.tudorgirba.com

description

I used this set of slides for a talk I gave at the Qualimetrie Club, Paris on June 2009.

Transcript of What history can tell us

Page 1: What history can tell us

what history can tell us

Tudor Gîrbawww.tudorgirba.com

Page 2: What history can tell us

2002

Page 3: What history can tell us

PhD2002 2005

Page 4: What history can tell us

PhD2002 2005 2009

PostDoc

Page 5: What history can tell us

PhD2002 2005 2009

PostDoc

Consultant

www.sw-eng.ch

Page 6: What history can tell us

}

{

}

{

}

{

}

{

forw

ard

engi

neer

ing

Page 7: What history can tell us

actual development}

{

}

{

}

{

}

{}

{

}

{

}

{}

{

}

{

forw

ard

engi

neer

ing

Page 8: What history can tell us

actual development}

{

}

{

}

{

}

{}

{

}

{

}

{}

{

}

{

forw

ard

engi

neer

ing

reverse engineering

Page 10: What history can tell us

Lanza, Ducasse 2003

Page 11: What history can tell us

actual development}

{

}

{

}

{

}

{}

{

}

{

}

{}

{

}

{

forw

ard

engi

neer

ing

reve

rse

engi

neer

ing

Page 12: What history can tell us

actual development}

{

}

{

}

{

}

{}

{

}

{

}

{}

{

}

{

forw

ard

engi

neer

ing

reve

rse

engi

neer

ing

reve

rse

engi

neer

ing

Page 13: What history can tell us

Lehman etal, 2001

Page 14: What history can tell us

Wu etal, 2004

commit

time

Page 15: What history can tell us

Lanza, Ducasse, 2002

Evolution Matrix shows changes in classes

Idle class

Pulsar class

Supernova class

White dwarf class

Page 16: What history can tell us

Lanza, Ducasse, 2002

Page 17: What history can tell us
Page 18: What history can tell us

what is the meta-model?

Page 19: What history can tell us

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

complex, large

Page 20: What history can tell us

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

}

{

}

{

}

{}

{

}

{

Page 21: What history can tell us

what is the meta-model?

Page 22: What history can tell us

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

Page 23: What history can tell us

Idleclass

Pulsarclass

Supernovaclass

White dwarfclass

Class

attributes

methods

Page 24: What history can tell us

Idleclass

Pulsarclass

Supernovaclass

White dwarfclass

Class

attributes

methods

Page 25: What history can tell us

Idleclass history

Pulsarclass history

Supernovaclass history

White dwarfclass history

ClassHistory

isPulsarisIdle

Page 26: What history can tell us

ClassVersion

SystemVersion

Page 27: What history can tell us

ClassVersion

ClassHistory

SystemVersion

Page 28: What history can tell us

ClassVersion

ClassHistory

SystemVersion

SystemHistory

Page 29: What history can tell us

ClassVersion

ClassHistory

SystemVersion

SystemHistory

Page 30: What history can tell us

VersionHistory

VersionHistory

Page 31: What history can tell us

VersionHistory

VersionHistoryHismo models history explicitlyGirba 2005

Page 32: What history can tell us

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, how?

Page 33: What history can tell us

1 5 3 4 4

4 2 1 0+++ = 7=

LENOM(C) = ∑ |NOMi(C)-NOMi-1(C)| 2i-nEvolution ofNumber of Methods

LENOM(C)

Gîrba etal 2004

Page 34: What history can tell us

Gîrba etal 2004

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=

Page 35: What history can tell us

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

Page 36: What history can tell us

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

Page 37: What history can tell us

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 can be measured

Page 38: What history can tell us

Evolution

Stability

Historical Max

Growth Trend

...

Number of Methods

Number of Lines of Code

Cyclomatic Complexity

Number of Modules

...

of

Page 39: What history can tell us

common wisdom: recently changed parts are likely to change in the near future

Page 40: What history can tell us

common wisdom: recently changed parts are likely to change in the near future

really?

Page 41: What history can tell us

30% 90%

Page 42: What history can tell us
Page 43: What history can tell us
Page 44: What history can tell us

present

Page 45: What history can tell us

present

past

Page 46: What history can tell us

present

past future

Page 47: What history can tell us

present

past future

Page 48: What history can tell us

present

past future

Page 49: What history can tell us

present

past future

prediction hit

Page 50: What history can tell us

present

past future

YesterdayWeatherHit(present):

past:=histories.topLENOM(start, present)

future:=histories.topEENOM(present, end)

past.intersectWith(future).notEmpty()

prediction hit

Page 51: What history can tell us

Yesterday’s Weather shows the localization of change

hit hit hit

YW = 3 / 8 = 37%

hit hit hit hit hit hit hit

YW = 7 / 8 = 87%

Girba etal, 2004

Page 52: What history can tell us

Detection Strategies are metric-based queriesto detect design flaws

Page 53: What history can tell us

God Class:

class.ATFD() > FEW &

class.WMC() >= VERY HIGH &

class.TCC() < ONE THIRD

Page 54: What history can tell us

what if it is stable?

God Class:

class.ATFD() > FEW &

class.WMC() >= VERY HIGH &

class.TCC() < ONE THIRD

Page 55: What history can tell us

Ratiu etal, 2004

Harmless God Class:

classhistory.last.isGodClass() &

classhistory.STABILITY(NOM) >= VERY HIGH

Page 56: What history can tell us

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

Page 57: What history can tell us

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

Page 58: What history can tell us

ClassVersion

ClassHistory

SystemVersion

SystemHistory

Page 59: What history can tell us

ClassVersion

ClassHistory

SystemVersion

SystemHistory

InheritanceVersion

Page 60: What history can tell us

InheritanceHistory

ClassVersion

ClassHistory

SystemVersion

SystemHistory

InheritanceVersion

Page 61: What history can tell us

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

Page 62: What history can tell us

Girba etal, 2005

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

B

D

C

E

A is persistent, B is stable, C was removed, E is newborn ...

Page 63: What history can tell us

Girba etal, 2005

Hierarchy Evolution reveals evolution patterns

Page 64: What history can tell us

A

B

C

D

E

1 2 3 4 5 6

B E

C D

A

Gall etal, 1998

Page 65: What history can tell us

A

B

C

D

E

1 2 3 4 5 6

Version

Page 66: What history can tell us

A

B

C

D

E

1 2 3 4 5 6

changed

Version

Page 67: What history can tell us

changed(i)

HistoryA

B

C

D

E

1 2 3 4 5 6

changed

Version

Page 68: What history can tell us

A

B

C

D

E

1 2 3 4 5 6

Page 69: What history can tell us

{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

Page 70: What history can tell us

{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

Page 71: What history can tell us

Parallel Inheritanceadd simultaneously children to several classes

Shotgun Surgerychange several classes simultaneously, but do not add methods

Page 72: What history can tell us

actual development}

{

}

{

}

{

}

{}

{

}

{

}

{}

{

}

{

reve

rse

engi

neer

ing

forw

ard

engi

neer

ing

reve

rse

engi

neer

ing