History Analysis (EVO 2008)

569 views

Published on

I used this set of slides for my lecture on Software Evolution held at the University of Berne.

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
569
On SlideShare
0
From Embeds
0
Number of Embeds
40
Actions
Shares
0
Downloads
19
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

History Analysis (EVO 2008)

  1. 1. History analysis Tudor Gîrba www.tudorgirba.com
  2. 2. Herodotus … displays his enquiry, so that human achievements may not become forgotten … and great and marvelous deeds … may not be without their glory … especially to show why the two peoples fought with each other. He rodotus
  3. 3. fo rw g rin ar ee d gin en gin en ee se rin erv g re { { { { { { } { { } } actual development } } } { } } }
  4. 4. { { } } } { { { } } re v er se en gin ee rin g reverse engineering fo actual development rw ar d en gin ee rin g { { } } { { } }
  5. 5. History holds useful information
  6. 6. History holds useful information When did it change?
  7. 7. 1 hman etal, 200 Le
  8. 8. Spectographs show change activity commit time 4 Wu etal, 200
  9. 9. History holds useful information When did it change? How did it change?
  10. 10. Evolution Matrix shows changes in classes Idle class Pulsar class Supernova class White dwarf class as se, 2002 Lan za, Duc
  11. 11. History holds useful information When did it change? How did it change? What changed?
  12. 12. 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
  13. 13. Evolution of Number of Methods LENOM(C) = ∑ |NOMi(C)-NOMi-1(C)| 2i-n LENOM(C) = 4 + 2 + 1 + 0 = 7 1 5 3 4 4
  14. 14. Latest Evolution of Number of Methods LENOM(C) = ∑ |NOMi(C)-NOMi-1(C)| 2i-n Earliest Evolution of Number of Methods EENOM(C) = ∑ |NOMi(C)-NOMi-1(C)| 22-i -3 -2 -1 0 LENOM(C) = 42 + 22 + 12 + 02 = 1.5 1 5 3 4 4 EENOM(C) = 4 20 + 2 2-1 + 1 2-2 + 0 2-3 = 5.25
  15. 15. ENOM LENOM EENOM 2 4 3 5 7 7 3.5 3.25 2 2 3 4 9 7 5.75 1.37 2 2 1 2 3 3 1 2 2 2 2 2 2 0 0 0 1 5 3 4 4 7 1.25 5.25
  16. 16. 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
  17. 17. 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 ... ...
  18. 18. History holds useful information When did it change? How did it change? What changed? What will change?
  19. 19. The recently changed parts are likely to change in the near future n wisdom Commo
  20. 20. The recently changed parts are likely to change in the near future e they really? Ar n wisdom Commo
  21. 21. 30% 90%
  22. 22. present
  23. 23. past present
  24. 24. past future present
  25. 25. past future present
  26. 26. past future present
  27. 27. past future prediction hit present
  28. 28. Yesterday’s Weather shows the locality of changes hit hit hit YW = 3 / 8 = 37% hit hit hit hit hit hit hit YW = 7 / 8 = 87% tal, 2004 Girba e
  29. 29. Co-change analysis recovers hidden dependencies 8 Gall etal 199
  30. 30. eRose suggests files to co-change 5 rmann etal 200 Zimme
  31. 31. History holds useful information When did it change? How did it change? What changed? What will change? Who did what?
  32. 32. 2 Eick etal 200
  33. 33. CVSscan shows fine grained changes e tal 2005 Voinea
  34. 34. Kumpel offers a different view on how files change 8 Jun ker 200
  35. 35. CVS shows activity
  36. 36. Who is responsible for this?
  37. 37. Who is responsible for this?
  38. 38. Alphabetical order is no order
  39. 39. Ownership Map reveals development patterns tal, 2006 Girba e
  40. 40. JEdit
  41. 41. Ant
  42. 42. Who copied from whom? (john 23.06.03) public boolean stillValid (ToDoItem I, Designer dsgr) { (bill 09.01.05) if (!isActive()) { (bill 09.01.05) return false (bill 09.01.05) } (steve 16.02.05) List offs = i.getOffenders(); (john 23.06.03) Object dm = offs.firstElement(); (steve 16.02.05) ListSet newOffs = computeOffenders(dm); (john 23.06.03) boolean res = offs.equals(newOffs); (john 23.06.03) return res; (george 13.02.05) public boolean stillValid (ToDoItem I, Designer dsgr) { (bill 11.13.05) if (!isActive()) { (bill 11.13.05) return false (bill 11.13.05) } (steve 16.02.05) List offs = i.getOffenders(); (george 13.02.05) Object dm = offs.firstElement(); (steve 16.02.05) ListSet newOffs = computeOffenders(dm); (george 13.02.05) boolean res = offs.equals(newOffs); (george 13.02.05) return res;
  43. 43. Who copied from whom? (john 23.06.03) public boolean stillValid (ToDoItem I, Designer dsgr) { (bill 09.01.05) if (!isActive()) { (bill 09.01.05) return false (bill 09.01.05) } (steve 16.02.05) List offs = i.getOffenders(); (john 23.06.03) Object dm = offs.firstElement(); (steve 16.02.05) ListSet newOffs = computeOffenders(dm); (john 23.06.03) boolean res = offs.equals(newOffs); (john 23.06.03) return res; (george 13.02.05) public boolean stillValid (ToDoItem I, Designer dsgr) { (bill 11.13.05) if (!isActive()) { (bill 11.13.05) return false (bill 11.13.05) } (steve 16.02.05) List offs = i.getOffenders(); (george 13.02.05) Object dm = offs.firstElement(); (steve 16.02.05) ListSet newOffs = computeOffenders(dm); (george 13.02.05) boolean res = offs.equals(newOffs); (george 13.02.05) return res;
  44. 44. When did changes happen? 23.06.03 public boolean stillValid (ToDoItem I, Designer dsgr) { 09.01.05 if (!isActive()) { 09.01.05 return false 09.01.05 } 16.02.05 List offs = i.getOffenders(); 23.06.03 Object dm = offs.firstElement(); 16.02.05 ListSet newOffs = computeOffenders(dm); 23.06.03 boolean res = offs.equals(newOffs); 23.06.03 return res; 13.02.05 public boolean stillValid (ToDoItem I, Designer dsgr) { 11.13.05 if (!isActive()) { 11.13.05 return false 11.13.05 } 16.02.05 List offs = i.getOffenders(); 13.02.05 Object dm = offs.firstElement(); 16.02.05 ListSet newOffs = computeOffenders(dm); 13.02.05 boolean res = offs.equals(newOffs); 13.02.05 return res;
  45. 45. Clone Evolution shows how developers copy tal, 2006 Balint e
  46. 46. History holds useful information When did it change? How did it change? What changed? What will change? Who did what? How to model history?
  47. 47. History holds useful information When did it change? How did it change? What changed? What will change? Who did what? How to model history? How to model structure changes?
  48. 48. { { { { } } } } { } A large system contains lots of details
  49. 49. { { { { { { { { { { { { { { { { { { { { } } } } } } } } } } } } } } } } { } } { } } { } } { } } { } Its history contains even more details
  50. 50. { { { { { { { { { { { { { { { { { { { { } } } } } } } } } } } } } } } } { } } { } } { } } { } } { } And lots of details are difficult to analyze
  51. 51. e.g., Evolution Matrix Idle class Pulsar class Supernova class attributes White dwarf class methods Class
  52. 52. e.g., Evolution Matrix Idle class Pulsar class Supernova class NOA White dwarf class NOM Class
  53. 53. e.g., Evolution Matrix Idle class Pulsar class Supernova class NOA White dwarf class NOM Class
  54. 54. e.g., Evolution Matrix Idle class history Pulsar class history Supernova class history ClassHistory White dwarf isPulsar class history isIdle ...
  55. 55. System Version Class Version
  56. 56. System Version Class Class History Version
  57. 57. System System History Version Class Class History Version
  58. 58. System System History Version Class Class History Version
  59. 59. System System History Version en tity st c lass 200 5 as fir Gir ba, his tory mo dels His mo Class Class History Version
  60. 60. 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
  61. 61. Evolution of Number of Methods LENOM(C) = ∑ |NOMi(C)-NOMi-1(C)| 2i-n LENOM(C) = 4 + 2 + 1 + 0 = 7 1 5 3 4 4
  62. 62. Latest Evolution of Number of Methods LENOM(C) = ∑ |NOMi(C)-NOMi-1(C)| 2i-n Earliest Evolution of Number of Methods EENOM(C) = ∑ |NOMi(C)-NOMi-1(C)| 22-i -3 -2 -1 0 LENOM(C) = 42 + 22 + 12 + 02 = 1.5 1 5 3 4 4 EENOM(C) = 4 20 + 2 2-1 + 1 2-2 + 0 2-3 = 5.25
  63. 63. past future present
  64. 64. past future YesterdayWeatherHit(present): present
  65. 65. past future YesterdayWeatherHit(present): past:=histories.topLENOM(start, present) present
  66. 66. past future YesterdayWeatherHit(present): past:=histories.topLENOM(start, present) future:=histories.topEENOM(present, end) present
  67. 67. past future YesterdayWeatherHit(present): past:=histories.topLENOM(start, present) future:=histories.topEENOM(present, end) past.intersectWith(future) present
  68. 68. past future YesterdayWeatherHit(present): past:=histories.topLENOM(start, present) future:=histories.topEENOM(present, end) past.intersectWith(future).notEmpty() prediction hit present
  69. 69. History holds useful information When did it change? How did it change? What changed? What will change? Who did what? How to model history? How to model structure changes? How to combine time with structure?
  70. 70. Detection Strategies are metric-based queries to detect design flaws Rule 1 METRIC 1 > Threshold 1 AND Quality problem Rule 2 METRIC 2 < Threshold 2
  71. 71. e.g., a God Class centralizes too much intelligence 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
  72. 72. e.g., a God Class centralizes too much intelligence 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 sta ble? it is Class cohesion is low t if TCC < ONE THIRD ut, wha B
  73. 73. God Class in the last version isGodClass(last) AND Harmless God Class Stable throughout the history Stability > 90% 4 Ratiu etal, 200
  74. 74. History holds useful information When did it change? How did it change? What changed? What will change? Who did what? How to model history? How to model structure changes? How to combine time with structure? How to model changes in relationships?
  75. 75. 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 A is persistent, B is stable, C was removed, E is newborn ...
  76. 76. 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
  77. 77. System System History Version Class Class History Version
  78. 78. System System History Version Inheritance Version Class Class History Version
  79. 79. System System History Version Inheritance Inheritance History Version Class Class History Version
  80. 80. 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 A is persistent, B is stable, C was removed, E is newborn ...
  81. 81. A changed methods changed age lines C B Removed Removed D E A is persistent, B is stable, C was removed, E is newborn ...
  82. 82. Hierarchy Evolution reveals patterns tal, 2005 Girba e
  83. 83. History holds useful information When did it change? How did it change? What changed? What will change? Who did what? How to model history? How to model structure changes? How to combine time with structure? How to model changes in relationships? How to model co-changes?
  84. 84. y relat ionships re n-ar Co-ch anges a 1 2 3 4 5 6 A A B B E C D E C D
  85. 85. 1 2 3 4 5 6 A B C D Version E
  86. 86. 1 2 3 4 5 6 A B C D Version E changed
  87. 87. 1 2 3 4 5 6 A History changed(i) B C D Version E changed
  88. 88. What is Formal Concept Analysis?
  89. 89. 1 2 3 4 5 6 A B C D E
  90. 90. {A, B, C, D, E} 1 2 3 4 5 6 Ø A {A, D, E} {A, B, C, D} {2} {6} B {D, E} {A, D} {A, B, 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}
  91. 91. {A, B, C, D, E} 1 2 3 4 5 6 Ø A {A, D, E} {A, B, C, D} {2} {6} B {D, E} {A, D} {A, B, 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} irba e tal 2007 G
  92. 92. Parallel Inheritance add simultaneously children to several classes Shotgun Surgery change several classes simultaneously, but do not add methods
  93. 93. System System History Version Inheritance Inheritance History Version Class Class History Version
  94. 94. System System History Version Inheritance Inheritance History Version Class Class History Version
  95. 95. History Version History Version History Version
  96. 96. History holds useful information When did it change? How did it change? What changed? What will change? Who did what? How to model history? How to model structure changes? How to combine time with structure? How to model changes in relationships? How to model co-changes? Issues How to sample history? What to capture? How to represent it?
  97. 97. { { } } } { { { } } re v er se en gin ee rin g reverse engineering fo actual development rw ar d en gin ee rin g { { } } { { } }
  98. 98. Tudor Gîrba www.tudorgirba.com creativecommons.org/licenses/by/3.0/

×