Software in Pictures 2008-03-12

1,527 views

Published on

Understanding software systems is hampered by their sheer size and complexity. Software visualization encodes the data found in these systems into pictures and enables the human eye to interpret it. In this lecture we present the concepts of software visualization and we show several examples of how visualizations can help in understanding software systems.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,527
On SlideShare
0
From Embeds
0
Number of Embeds
199
Actions
Shares
0
Downloads
45
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Software in Pictures 2008-03-12

  1. 1. Software in pictures Tudor Gîrba www.tudorgirba.com
  2. 2. Software is complex. 29% Succeeded 18% Failed 53% Challenged The Standish Group, 2004
  3. 3. How large is your project?
  4. 4. How large is your project? 1’000’000 lines of code
  5. 5. How large is your project? 1’000’000 lines of code * 2 = 2’000’000 seconds
  6. 6. How large is your project? 1’000’000 lines of code * 2 = 2’000’000 seconds / 3600 = 560 hours
  7. 7. How large is your project? 1’000’000 lines of code * 2 = 2’000’000 seconds / 3600 = 560 hours / 8 = 70 days
  8. 8. How large is your project? 1’000’000 lines of code * 2 = 2’000’000 seconds / 3600 = 560 hours / 8 = 70 days / 20 = 3 months
  9. 9. fo rw ar d en gin ee rin g { { { { { { } { { } } actual development } } } { } } }
  10. 10. fo rw g rin ar ee d gin en gin en ee se rin erv g re { { { { { { } { { } } actual development } } } { } } }
  11. 11. McCabe = 21 NOM 0 = 102 3 ,00 75 = C LO Metrics Queries Visualizations ... { { { { } } } } { }
  12. 12. McCabe = 21 NOM 0 = 102 3 ,00 75 = C LO Metrics Queries Visualizations ... { { { { } } } } { }
  13. 13. What are software metrics?
  14. 14. Youcannot control what you cannot measure. Tom de Marco
  15. 15. Software metrics are measurements which relate to software systems, processes or related documents
  16. 16. Metrics compress the system into numbers.
  17. 17. Examples of size metrics NOM - number of methods NOA - number of attributes LOC - number of lines of code NOS - number of statements NOC - number of children Lorentz, Kidd, 1994 Chidamber, 1994
  18. 18. McCabe cyclomatic complexity counts the number of possible paths through the code of a function. McCabe, 1977
  19. 19. McCabe = 21 NOM 0 = 102 3 ,00 75 = C LO Metrics Queries Visualizations ... { { { { } } } } { }
  20. 20. McCabe = 21 NOM 0 = 102 3 ,00 75 = C LO Metrics Queries Visualizations ... { { { { } } } } { }
  21. 21. Queries reduce the analysis space.
  22. 22. 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
  23. 23. Example: a God Class centralizes too much intelligence in the system. Lanza, Marinescu 2006 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
  24. 24. McCabe = 21 NOM 0 = 102 3 ,00 75 = C LO Metrics Queries Visualizations ... { { { { } } } } { }
  25. 25. McCabe = 21 NOM 0 = 102 3 ,00 75 = C LO Metrics Queries Visualizations ... { { { { } } } } { }
  26. 26. Software in pictures Tudor Gîrba www.tudorgirba.com
  27. 27. 1946
  28. 28. 1956
  29. 29. 1956
  30. 30. 1956
  31. 31. 1956 2006
  32. 32. 1956 2006
  33. 33. 1956 2006
  34. 34. 1956 2006 ?
  35. 35. Visualization compresses the system into pictures.
  36. 36. 1854, London, cholera epidemic
  37. 37. 1854, London, cholera epidemic
  38. 38. A picture is worth a thousand words.
  39. 39. UML took it literally :)
  40. 40. We are visual beings.
  41. 41. How many groups do you see?
  42. 42. How many groups do you see?
  43. 43. How many groups do you see?
  44. 44. How many groups do you see?
  45. 45. Gestalt principles proximity similarity enclosure connectivity
  46. 46. More Gestalt principles closure continuity
  47. 47. We are visual beings.
  48. 48. A picture is worth a thousand words.
  49. 49. UML took it literally :)
  50. 50. Example: what is ?
  51. 51. Polymetric views show up to 5 metrics. Lanza, 2003 Width metric Height metric Position metrics Color metric
  52. 52. System Complexity shows class hierarchies. Lanza, Ducasse, 2003 attributes methods lines
  53. 53. Class Blueprint shows class internals. Lanza, Ducasse, 2005 Initialize Interface Internal Accessor Attribute invocation and access direction
  54. 54. Class Blueprint has a rich vocabulary. internal access Access external Attribute access Invocation Regular Constant invocations Overriding Delegating lines Method Extending Setter Abstract Getter
  55. 55. Class Blueprint shows class internals.
  56. 56. Distribution Map shows properties over structure. Ducasse etal, 2006 31 parts, 394 elements and 9 properties
  57. 57. Code City shows where your code lives. Wettel, Lanza, 2007 classes are buildings grouped in quarters of packages
  58. 58. Object Flow shows how objects move. Lienhard etal, 2007 objects flowing through other objects
  59. 59. fo rw g rin ar ee d gin en gin en ee se rin erv g re { { { { { { } { { } } actual development } } } { } } }
  60. 60. { { } } } { { { } } re v er se en gin ee rin g reverse engineering fo rw ar actual development d en gin ee rin g { { } } { { } }
  61. 61. Spectographs show change activity. Wu etal, 2004 commit time
  62. 62. Evolution Matrix shows changes in classes. Lanza, Ducasse, 2002 Idle class Pulsar class Supernova class White dwarf class
  63. 63. Evolution Matrix shows changes in classes
  64. 64. 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
  65. 65. 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
  66. 66. 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 ...
  67. 67. Hierarchy Evolution 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 ...
  68. 68. Hierarchy Evolution reveals patterns. Girba etal, 2005
  69. 69. Evolution Radar shows co-change relationships. D’Ambros, Lanza 2006 one package and its co-change relationships
  70. 70. McCabe = 21 NOM 0 = 102 3 ,00 75 = C LO Metrics Queries Visualizations ... { { { { } } } } { }
  71. 71. McCabe = 21 NOM 0 = 102 3 ,00 75 = C LO Metrics Queries Visualizations ... { { { { } } } } { }
  72. 72. moose.unibe.ch
  73. 73. McCabe = 21 NOM 0 = 102 3 ,00 75 = C LO Metrics Queries Visualizations ... { { { { } } } } { }
  74. 74. But, what actually happens behind the scene?
  75. 75. System Complexity 1 node type 1 edge type 3 metrics Class Blueprint 3 node types 2 edge types 3 metrics 8 properties
  76. 76. A small experiment
  77. 77. 1, 13, 27, 4, 96
  78. 78. What were the numbers?
  79. 79. Easy!
  80. 80. What was the last advertisement you saw?
  81. 81. Not so easy!
  82. 82. Each visualization provides a language that needs to be learnt.
  83. 83. So, what does happen behind the scene?
  84. 84. Principle: Minimize chart junk Tufte, 1990
  85. 85. Excel default
  86. 86. Excel default Excel default + 6 actions
  87. 87. Distribution Map shows properties. Ducasse etal, 2006
  88. 88. Principle: Maximize data ink Tufte, 1990 Tufte, 1990
  89. 89. InfoBug is cute and condensed. Chuah, Eick, 2006
  90. 90. So, what does happen behind the scene?
  91. 91. Example 1: CVS shows activity.
  92. 92. Who did this?
  93. 93. Alphabetical order is no order.
  94. 94. Ownership Map orders histories to reveal patterns. Girba etal, 2006
  95. 95. Example 2: 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;
  96. 96. What is useless? (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;
  97. 97. 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;
  98. 98. Clone Evolution shows how developers copy. Balint etal, 2006
  99. 99. Not every picture is worth a thousand words.
  100. 100. One more thing ...
  101. 101. Visualization is art, too.
  102. 102. Tudor Gîrba www.tudorgirba.com creativecommons.org/licenses/by/3.0/

×