Crosscutting Concerns Using Historical Code Changes Bram Adams - - PowerPoint PPT Presentation

crosscutting concerns
SMART_READER_LITE
LIVE PREVIEW

Crosscutting Concerns Using Historical Code Changes Bram Adams - - PowerPoint PPT Presentation

Identifying Crosscutting Concerns Using Historical Code Changes Bram Adams Zhen Ming Jiang Ahmed E. Hassan SAIL, Queen's University http://sailhome.cs.queensu.ca/~bram/ What are crosscutting concerns? 2 Crosscutting Concerns 3


slide-1
SLIDE 1

Identifying

Crosscutting Concerns

Using

Historical Code Changes

Bram Adams

Zhen Ming Jiang Ahmed E. Hassan

SAIL, Queen's University http://sailhome.cs.queensu.ca/~bram/

slide-2
SLIDE 2

What are crosscutting concerns?

2

slide-3
SLIDE 3

Crosscutting

Concerns

3

slide-4
SLIDE 4

Crosscutting

Concerns

3

slide-5
SLIDE 5

Crosscutting

Concerns

multi-threading tracing exception handling data persistence security memory cleanup 3D rendering p e r f

  • r

m a n c e sound support

3

slide-6
SLIDE 6

Crosscutting

Concerns

multi-threading tracing exception handling data persistence security memory cleanup 3D rendering p e r f

  • r

m a n c e sound support

3

slide-7
SLIDE 7

Crosscutting

Concerns

multi-threading tracing exception handling data persistence security memory cleanup 3D rendering p e r f

  • r

m a n c e sound support

3

slide-8
SLIDE 8

Crosscutting

Concerns

multi-threading tracing exception handling data persistence security memory cleanup 3D rendering p e r f

  • r

m a n c e sound support

3

slide-9
SLIDE 9

Crosscutting

Concerns

multi-threading tracing exception handling data persistence security memory cleanup 3D rendering p e r f

  • r

m a n c e sound support

3

slide-10
SLIDE 10

Crosscutting

Concerns

multi-threading tracing exception handling data persistence security memory cleanup 3D rendering p e r f

  • r

m a n c e sound support

3

slide-11
SLIDE 11

Crosscutting

Concerns

multi-threading tracing exception handling data persistence security memory cleanup 3D rendering p e r f

  • r

m a n c e sound support

3

slide-12
SLIDE 12

Crosscutting

Concerns

multi-threading tracing exception handling data persistence security memory cleanup 3D rendering p e r f

  • r

m a n c e sound support

3

slide-13
SLIDE 13

Crosscutting

Concerns

multi-threading tracing exception handling data persistence security memory cleanup 3D rendering p e r f

  • r

m a n c e sound support

3

slide-14
SLIDE 14

Crosscutting

Concerns

multi-threading tracing exception handling data persistence security memory cleanup 3D rendering p e r f

  • r

m a n c e sound support

3

slide-15
SLIDE 15
  • 1. Which concerns are implemented?
  • 2. Where?
  • 3. How are concerns composed together?

(Crosscutting) Concern Mining

4

slide-16
SLIDE 16
  • 1. What is a Crosscutting Concern?
  • 2. The Concern Mining Process and its

Shortcomings

  • 3. COMMIT
  • 4. Case Study
  • 5. Conclusion

5

slide-17
SLIDE 17

Concern Mining Process

data source

6

slide-18
SLIDE 18

Concern Mining Process

data source concern seeds 1

6

slide-19
SLIDE 19

Concern Mining Process

data source concern seeds Concern Mining Techniques :-) 1

6

slide-20
SLIDE 20

Concern Mining Process

data source concern seeds Concern Mining Techniques :-) concerns 1 2

6

slide-21
SLIDE 21

Concern Mining Process

data source concern seeds expanded concerns Concern Mining Techniques :-) concerns 1 2 3

6

slide-22
SLIDE 22

Concern Mining Process

data source concern seeds expanded concerns concern composition Concern Mining Techniques :-) concerns 1 2 3 4

6

slide-23
SLIDE 23

Concern Mining Process

data source concern seeds expanded concerns concern composition Concern Mining Techniques :-) MANUAL :-( concerns 1 2 3 4

6

slide-24
SLIDE 24

Concern Mining Process

data source concern seeds expanded concerns concern composition Concern Mining Techniques :-) MANUAL :-( concerns 1 2 3 4

6

slide-25
SLIDE 25

S1: Limited Context

1 2 3 4

7

slide-26
SLIDE 26

S1: Limited Context

thread() process() block() clean() 1 2 3 4

7

slide-27
SLIDE 27

S1: Limited Context

thread() process() mutex semaphore_t address sender subject block() DEFINED_LINUX clean() 1 2 3 4

7

slide-28
SLIDE 28

S1: Limited Context

thread() process() mutex semaphore_t address sender subject CVS block() DEFINED_LINUX clean() thread() 1 2 3 4

7

slide-29
SLIDE 29

S2: Noise

1 2 3 4

8

slide-30
SLIDE 30

S2: Noise

1 2 3 4

8

slide-31
SLIDE 31

S2: Noise

1 2 3 4

8

slide-32
SLIDE 32

S3: No Composition

random

encrypt

decrypt seed

1 2 3 4

9

slide-33
SLIDE 33

S3: No Composition

random

encrypt

decrypt seed

random

encrypt

decrypt seed

1 2 3 4

9

slide-34
SLIDE 34
  • 1. What is a Crosscutting Concern?
  • 2. The Concern Mining Process and its

Shortcomings

  • 3. COMMIT
  • 4. Case Study
  • 5. Conclusion

10

slide-35
SLIDE 35

COncern Mining using Mutual Information over Time

CVS

11

limited context noise no composition

slide-36
SLIDE 36

COncern Mining using Mutual Information over Time

analyze historical changes to all code entities

CVS

11

limited context noise no composition

slide-37
SLIDE 37

COncern Mining using Mutual Information over Time

analyze historical changes to all code entities statistical clustering based on mutual information

CVS

11

limited context noise no composition

slide-38
SLIDE 38
  • S1. Historical Data Sources

CVS

CVS

12

slide-39
SLIDE 39
  • S1. Historical Data Sources

CVS

transactions

CVS

12

slide-40
SLIDE 40
  • S1. Historical Data Sources

CVS

transactions

CVS

12

slide-41
SLIDE 41
  • S1. Historical Data Sources

CVS

transactions

CVS

function call or variable access added

12

slide-42
SLIDE 42
  • S1. Historical Data Sources

CVS

transactions

CVS

function call or variable access added intentional co- addition of calls and accesses

12

slide-43
SLIDE 43
  • S1. Historical Data Sources

CVS

transactions

CVS

function call or variable access added intentional co- addition of calls and accesses

concern seed

12

slide-44
SLIDE 44
  • S2. Mutual

Information

13

slide-45
SLIDE 45
  • S2. Mutual

Information

13

slide-46
SLIDE 46
  • S2. Mutual

Information

13

slide-47
SLIDE 47
  • S2. Mutual

Information

13

slide-48
SLIDE 48
  • S2. Mutual

Information

13

slide-49
SLIDE 49
  • S2. Mutual

Information

13

slide-50
SLIDE 50
  • S2. Mutual

Information

13

slide-51
SLIDE 51
  • S2. Mutual

Information

13

slide-52
SLIDE 52
  • S2. Mutual

Information

13

slide-53
SLIDE 53
  • S2. Mutual

Information

13

slide-54
SLIDE 54
  • S2. Mutual

Information

13

slide-55
SLIDE 55
  • S2. Mutual

Information

13

slide-56
SLIDE 56
  • S2. Mutual

Information

13

slide-57
SLIDE 57
  • S2. Mutual

Information

14

slide-58
SLIDE 58

How much does occurrence of reveal about occurrence of ?

  • S2. Mutual

Information

14

slide-59
SLIDE 59

How much does occurrence of reveal about occurrence of ?

  • S2. Mutual

Information

14

slide-60
SLIDE 60

How much does occurrence of reveal about occurrence of ?

  • S2. Mutual

Information

14

slide-61
SLIDE 61

How much does occurrence of reveal about occurrence of ?

  • S2. Mutual

Information

14

slide-62
SLIDE 62

How much does occurrence of reveal about occurrence of ?

  • S2. Mutual

Information

14

slide-63
SLIDE 63
  • S3. Concern Relations

seed graph

15

slide-64
SLIDE 64
  • S3. Concern Relations

15

slide-65
SLIDE 65
  • S3. Concern Relations

composite concern simple concern

15

slide-66
SLIDE 66
  • 1. What is a Crosscutting Concern?
  • 2. The Concern Mining Process and its

Shortcomings

  • 3. COMMIT
  • 4. Case Study
  • 5. Conclusion

16

slide-67
SLIDE 67

Case Study

1996-2002 1993-2003

(800 kLOC) (2 MLOC)

17

slide-68
SLIDE 68

Comparative Study

18

CBFA HAM COMMIT

similar entity names

identical set

  • f callers

mutual information

limited context noise no composition

slide-69
SLIDE 69

Comparative Study

18

CBFA HAM COMMIT

similar entity names

identical set

  • f callers

mutual information

limited context noise no composition

slide-70
SLIDE 70

Comparative Study

18

CBFA HAM COMMIT

similar entity names

identical set

  • f callers

mutual information

limited context noise no composition

CVS CVS

snapshot

slide-71
SLIDE 71

Comparative Study

18

CBFA HAM COMMIT

similar entity names

identical set

  • f callers

mutual information

limited context noise no composition

CVS CVS

snapshot

slide-72
SLIDE 72

Comparative Study

18

CBFA HAM COMMIT

similar entity names

identical set

  • f callers

mutual information

limited context noise no composition

CVS CVS

snapshot

slide-73
SLIDE 73

Study Design

19

slide-74
SLIDE 74

Study Design

19

slide-75
SLIDE 75

Study Design

CBFA HAM COMMIT

19

slide-76
SLIDE 76

Study Design

CBFA HAM COMMIT top 20 top 20 top 20

19

slide-77
SLIDE 77

Study Design

CBFA HAM COMMIT top 20 top 20 top 20

19

concern?

slide-78
SLIDE 78

Study Design

CBFA HAM COMMIT top 20 top 20 top 20

19

slide-79
SLIDE 79

Study Design

CBFA HAM COMMIT

19

slide-80
SLIDE 80

Study Design

CBFA HAM COMMIT

19

slide-81
SLIDE 81

Study Design

CBFA HAM COMMIT top 20 top 20 top 20

19

slide-82
SLIDE 82

Study Design

CBFA HAM COMMIT top 20 top 20 top 20

19

top 20 top 20 top 20

slide-83
SLIDE 83
  • H1. Richer Data Sources

Yield richer Seeds

CVS

20

slide-84
SLIDE 84
  • H1. Richer Data Sources

Yield richer Seeds

8 16 24 32 40 CBFA HAM COMMIT 45 90 135 180 225 CBFA HAM COMMIT

#non-function entities #functions

CVS

20

slide-85
SLIDE 85
  • H1. Richer Data Sources

Yield richer Seeds

8 16 24 32 40 CBFA HAM COMMIT 45 90 135 180 225 CBFA HAM COMMIT

#non-function entities #functions

CVS

20

50% 79% 83% 29% 88% 75%

slide-86
SLIDE 86
  • H2. COMMIT Identifies a Larger

Percentage of unique Concerns

21

slide-87
SLIDE 87
  • H2. COMMIT Identifies a Larger

Percentage of unique Concerns

21

20 40 60 80 100 CBFA HAM COMMIT 20 40 60 80 100 CBFA HAM COMMIT

slide-88
SLIDE 88
  • H2. COMMIT Identifies a Larger

Percentage of unique Concerns

21

20 40 60 80 100 CBFA HAM COMMIT

56% 56%

20 40 60 80 100 CBFA HAM COMMIT

87.5% 50%

slide-89
SLIDE 89
  • H3. COMMIT complements

CBFA and HAM (1)

22

slide-90
SLIDE 90
  • H3. COMMIT complements

CBFA and HAM (1)

22

CBFA HAM COMMIT

1 8 14 9

CBFA HAM COMMIT

1 9 14 9

slide-91
SLIDE 91
  • H3. COMMIT complements

CBFA and HAM (2)

23

slide-92
SLIDE 92

d1 d2 d3 d4 d5 d6 d7 d8 d9

  • H3. COMMIT complements

CBFA and HAM (2)

device drivers

23

kernel

slide-93
SLIDE 93

d1 d2 d3 d4 d5 d6 d7 d8 d9

  • H3. COMMIT complements

CBFA and HAM (2)

CBFA concern (e.g., driver API)

23

kernel

slide-94
SLIDE 94

d1 d2 d3 d4 d5 d6 d7 d8 d9

  • H3. COMMIT complements

CBFA and HAM (2)

CBFA concern (e.g., driver API) HAM concern (e.g., cloned driver code)

23

kernel

slide-95
SLIDE 95

d1 d2 d3 d4 d5 d6 d7 d8 d9

  • H3. COMMIT complements

CBFA and HAM (2)

CBFA concern (e.g., driver API) HAM concern (e.g., cloned driver code) COMMIT concern (e.g., driver + infrastructure)

23

kernel

slide-96
SLIDE 96

d1 d2 d3 d4 d5 d6 d7 d8 d9

  • H3. COMMIT complements

CBFA and HAM (2)

CBFA concern (e.g., driver API) HAM concern (e.g., cloned driver code) COMMIT concern (e.g., driver + infrastructure)

23

kernel

slide-97
SLIDE 97

24

ODBC Data Retrieval Composite Concern

slide-98
SLIDE 98

24

ODBC Data Retrieval Composite Concern

  • 1. connection configuration
slide-99
SLIDE 99

1

24

ODBC Data Retrieval Composite Concern

ODBC

  • 1. connection configuration
slide-100
SLIDE 100

1 2

24

ODBC Data Retrieval Composite Concern

ODBC

  • 1. connection configuration
  • 2. connection error handling
slide-101
SLIDE 101

1 3 2

24

ODBC Data Retrieval Composite Concern

ODBC

  • 1. connection configuration
  • 2. connection error handling
  • 3. data transfer
slide-102
SLIDE 102

1 3 2 4

24

ODBC Data Retrieval Composite Concern

ODBC

  • 1. connection configuration
  • 2. connection error handling
  • 3. data transfer
  • 4. SQL-to-ODBC conversion
slide-103
SLIDE 103

1 3 2 4 5

24

ODBC Data Retrieval Composite Concern

ODBC

  • 1. connection configuration
  • 2. connection error handling
  • 3. data transfer
  • 4. SQL-to-ODBC conversion
  • 5. ODBC-to-ESQL conversion
slide-104
SLIDE 104

1 3 2 6 4 5

24

ODBC Data Retrieval Composite Concern

ODBC

  • 1. connection configuration
  • 2. connection error handling
  • 3. data transfer
  • 4. SQL-to-ODBC conversion
  • 5. ODBC-to-ESQL conversion
  • 6. conversion error handling
slide-105
SLIDE 105

1 3 4 6 2 1 3 2 6 4 5 5

24

ODBC Data Retrieval Composite Concern

ODBC

  • 1. connection configuration
  • 2. connection error handling
  • 3. data transfer
  • 4. SQL-to-ODBC conversion
  • 5. ODBC-to-ESQL conversion
  • 6. conversion error handling
slide-106
SLIDE 106

36 seeds

25

slide-107
SLIDE 107

36 seeds ODBC Data Retrieval Concern

25

slide-108
SLIDE 108

36 seeds ODBC Data Retrieval Concern

25

5 other composite concerns

slide-109
SLIDE 109

Threats to Validity

  • generalizability to other systems
  • subjectivity ↔ substantial agreement (Kappa)
  • seed quality not checked
  • threshold optimization is task-specific

26

slide-110
SLIDE 110
  • 1. What is a Crosscutting Concern?
  • 2. The Concern Mining Process and its

Shortcomings

  • 3. COMMIT
  • 4. Case Study
  • 5. Conclusion

27

slide-111
SLIDE 111

28

slide-112
SLIDE 112

Crosscutting Concerns

multi-threading t r a c i n g e x c e p t i

  • n

h a n d l i n g data persistence s e c u r i t y m e m

  • r

y c l e a n u p 3D rendering performance sound support

28

slide-113
SLIDE 113

Crosscutting Concerns

multi-threading t r a c i n g e x c e p t i

  • n

h a n d l i n g data persistence s e c u r i t y m e m

  • r

y c l e a n u p 3D rendering performance sound support

28

Concern Mining Shortcomings

  • S1. limited seed context
  • S2. noise between seeds
  • S3. no composition of concerns
slide-114
SLIDE 114

Crosscutting Concerns

multi-threading t r a c i n g e x c e p t i

  • n

h a n d l i n g data persistence s e c u r i t y m e m

  • r

y c l e a n u p 3D rendering performance sound support

28

Concern Mining Shortcomings

  • S1. limited seed context
  • S2. noise between seeds
  • S3. no composition of concerns

COMMIT

CVS

transactions

function call or variable access added intentional co- addition of calls and accesses

concern seed

slide-115
SLIDE 115

Crosscutting Concerns

multi-threading t r a c i n g e x c e p t i

  • n

h a n d l i n g data persistence s e c u r i t y m e m

  • r

y c l e a n u p 3D rendering performance sound support

28

COMMIT complements CBFA and HAM

CBFA HAM COMMIT

1 8 14 9

CBFA HAM COMMIT

1 9 14 9

Concern Mining Shortcomings

  • S1. limited seed context
  • S2. noise between seeds
  • S3. no composition of concerns

COMMIT

CVS

transactions

function call or variable access added intentional co- addition of calls and accesses

concern seed

slide-116
SLIDE 116

QUESTIONS?

Crosscutting Concerns

multi-threading t r a c i n g e x c e p t i

  • n

h a n d l i n g data persistence s e c u r i t y m e m

  • r

y c l e a n u p 3D rendering performance sound support

28

COMMIT complements CBFA and HAM

CBFA HAM COMMIT

1 8 14 9

CBFA HAM COMMIT

1 9 14 9

Concern Mining Shortcomings

  • S1. limited seed context
  • S2. noise between seeds
  • S3. no composition of concerns

COMMIT

CVS

transactions

function call or variable access added intentional co- addition of calls and accesses

concern seed