How History Justifies System Architecture (or Not)

2,060 views

Published on

Presented at IWPSE 2003.

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

  • Be the first to like this

No Downloads
Views
Total views
2,060
On SlideShare
0
From Embeds
0
Number of Embeds
380
Actions
Shares
0
Downloads
16
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

How History Justifies System Architecture (or Not)

  1. 1. 1/12 International Workshop on Principles of Software Evolution · Helsinki, Finland, 1 September 2003 How History Justifies System Architecture (or not) Thomas Zimmermann (with Stephan Diehl and Andreas Zeller) Lehrstuhl Softwaretechnik Universit¨t des Saarlandes, Saarbr¨cken, Germany a u
  2. 2. 2/12 The Problem Your task: extend the debug component in GCC! You identify the variable xcoff debug hooks. What else do you need to change?
  3. 3. 2/12 The Problem Your task: extend the debug component in GCC! You identify the variable xcoff debug hooks. What else do you need to change? General issue: only change coupled entities! You can detect existing coupling by • Program Analysis—e.g. def-use associations. • Learning from History—entities changed together.
  4. 4. 3/12 Evolutionary Coupling 34 gcc/gcc/dbxout.c [134] gcc/gcc/sdbout.c [74] dbx_debug_hooks sdb_debug_hooks [12] [12] [10] xcoff_debug_hooks
  5. 5. 3/12 Evolutionary Coupling 34 gcc/gcc/dbxout.c [134] gcc/gcc/sdbout.c [74] dbx_debug_hooks sdb_debug_hooks 12 [12] [12] 10 10 [10] xcoff_debug_hooks Support: How much evidence (= simultaneous changes)? Confidence: How relevant is coupling for participants?
  6. 6. 3/12 Evolutionary Coupling 34 gcc/gcc/dbxout.c [134] gcc/gcc/sdbout.c [74] dbx_debug_hooks sdb_debug_hooks 12 [12] [12] 4 10 4 10 [10] [4] 4 xcoff_debug_hooks sdb_global_decl() dbx_functions_end() [6] [7] 2 dbx_symbol_name() Support: How much evidence (= simultaneous changes)? Confidence: How relevant is coupling for participants?
  7. 7. 4/12 What We Do Our ROSE prototype analyzes evolution of CVS archives. ROSE Couplings Reengineering Of Software Evolution Graphs CVS Step 1: Restore Transactions from CVS Metrics Step 2: Identify Modified Entities ROSE determines entities at different granularities: coarse-granular entities: directories, modules, files fine-granular entities: methods, variables, sections
  8. 8. 5/12 Step 1: Restoring Transactions Two atomic changes δi and δi+1 are part of one transaction ∆ = (δ1 , . . . , δn ) if: author(δi ) = author(δi+1 ) ∧ log message(δi ) = log message(δi+1 ) ∧ |time(δi+1 ) − time(δi )| < 200 seconds We use a sliding window instead of a fixed one. GNU C Compiler (GCC): The average transaction length is 6.2 seconds. The maximal transaction length is 1 hour 32 minutes.
  9. 9. 6/12 Step 2: Light-Weight Analysis File: Animals.java 1 class Cat { 3 public String[] COLORS = { ... 23 } 25 public Cat() { ... 30 } ... 56 } 58 class Dog { 60 public String[] COLORS = { ... 80 } ... 99 }
  10. 10. 6/12 Step 2: Light-Weight Analysis File: Animals.java Step A: Map to Entities 1 class Cat { 3 public String[] COLORS = { Cat.COLORS ... lines 3-23 23 } Class Cat 25 lines 1-56 public Cat() { Cat.Cat() ... lines 25-30 30 } ... 56 } 58 class Dog { 60 public String[] COLORS = { Dog.COLORS Class Dog ... lines 60-80 lines 58-99 80 } ... 99 }
  11. 11. 6/12 Step 2: Light-Weight Analysis File: Animals.java Step A: Map to Entities 1 class Cat { 3 public String[] COLORS = { Cat.COLORS 17 ... lines 3-23 23 } Class Cat 25 lines 1-56 public Cat() { Cat.Cat() ... lines 25-30 30 } ... 56 } 58 class Dog { 60 public String[] COLORS = { Dog.COLORS Class Dog ... lines 60-80 lines 58-99 80 } ... 99 } Step B: Filter Entities We analyze C/C++, JAVA, PYTHON, TEX and TEXINFO files. We get the modified methods, variables and subsections.
  12. 12. 7/12 Example: GCC i386.c pentiumpro_cost [12] i486_cost pentium_cost [11] [11] [12] i386_cost [14] k6_cost
  13. 13. 7/12 Example: GCC i386.c pentiumpro_cost [12] i486_cost pentium_cost [11] [11] 11 [12] i386_cost [14] k6_cost
  14. 14. 7/12 Example: GCC i386.c i386.h pentiumpro_cost [12] i486_cost pentium_cost [11] 9 [11] [11] 11 processor_cost [12] i386_cost [14] k6_cost
  15. 15. 8/12 Visualizing Coupling A B C D High Confidence A B C Low Confidence D No Coupling (No Support)
  16. 16. 8/12 Visualizing Coupling A B C D High Confidence A B C Low Confidence D No Coupling (No Support) A C [3] A ⇒ C: Confidence 3/10 = 30% [10] [4] C ⇒ A: Confidence 3/4 = 75%
  17. 17. 9/12 Comparing Architecture with Evolution Directory ddd/ DDD Source Libraries Pics Icons Patches Tests
  18. 18. 9/12 Comparing Architecture with Evolution Directory ddd/ DDD Source Bad architecture Libraries Pics Icons Patches Tests Better architecture
  19. 19. 10/12 Measuring Evolutionary Coupling Evolutionary Coupling Index (ECI). Different levels: entity/file or file/directory level. # external couplings ECI = # internal couplings The lower the ECI, the better the modularity.
  20. 20. 10/12 Measuring Evolutionary Coupling Evolutionary Coupling Index (ECI). Different levels: entity/file or file/directory level. # external couplings ECI = # internal couplings The lower the ECI, the better the modularity. File/Directory Entity/File ECI ECI ECIfiltered GCC 5.757 3.615 1.504 DDD 0.250 4.462 1.922 APACHE 2.827 11.815 0.675 OPENSSL 8.665 101.053 7.859 Comparing only one level may be misleading (DDD).
  21. 21. 11/12 Guiding the Programmer
  22. 22. 12/12 Conclusion Fine-grained evolutionary coupling. . . • detects coupling between non-program entities. e.g. coupling between a function and a database schema • guides developers while making changes. Programmers who changed this function also changed. . . • gives better(?) results than coarse-grained coupling. Coupling between files doesn’t tell you that much • can be compared with given coupling (= architecture). Results are mixed—what is coupling, anyway? Those who cannot learn from history are doomed to repeat it. (George Santayana)

×