comp589 (1)

22
Applicability of Three Cognitive Complexity Metrics Arvin Foroutan Stan Pastukhov

Upload: stan-pastukhov

Post on 08-Jan-2017

176 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: COMP589 (1)

Applicability of Three Cognitive Complexity MetricsArvin ForoutanStan Pastukhov

Page 2: COMP589 (1)

Software Complexity

Can be the execution time required to perform a computation

Or maybe the level of difficulty of tasks such as coding, debugging, testing or modifying software

Page 3: COMP589 (1)

Cognitive Complexity

The human effort needed to perform a task

Or the difficulty in understanding the software

Page 4: COMP589 (1)

Why is this important?

Unlike new software development, maintaining and expanding existing code is extremely difficult

Prone to cost overruns, delays, and defects

Page 5: COMP589 (1)

Cognitive Weight

The degree of difficulty or relative time and effort for comprehending a given piece of software

Modeled by a number of basic control structures (BCS)

Sequential, Branch, Iteration, Recursion and Parallel

Page 6: COMP589 (1)

The Big 3: Which is best?

Cognitive Weight Complexity Measure (CWCM)

Cognitive Functional Size (CFS)

Cognitive Information Complexity Measure (CICM)

Page 7: COMP589 (1)

Cognitive Weight Complexity Measure (CWCM)

Considers only the cognitive weights (Wc) of the basic control structures of the software

Language independentSimple and easy to calculateGives the complexity in small numbers

Page 8: COMP589 (1)

Bubble Sort - CWCM Metric CWCM = Wc

Where:

Wc = Total cognitive weight of software

BCS (iteration) W1 = 3

BCS (iteration) W2 = 3

BCS (branch) W3 = 2

BCS (branch) W4= 2

Wc = 3(3(2)) + 2) = 24

Page 9: COMP589 (1)

Cognitive Functional Size (CFS)

Based on cognitive weights of basic control structures and number of inputs and outputs

Easy to calculateDoes not rely on the implementation technologies

Uses sound principles

Page 10: COMP589 (1)

Bubble Sort - CFS metric

CFS = (No + Ni) * Wc

Where:

No = Number of outputs

Ni = Number of inputs

Wc = Sum of cognitive weights of linear blocks

CFS = (0 + 1) * 24 = 24

Page 11: COMP589 (1)

Cognitive Information Complexity Metric (CICM)Calculated by getting the product of cognitive weight (Wc) of the basic control structures and the weighted information count (WICS)

Dependent on the internal architecture of the software

Slightly more difficult to calculateGives complexity in larger numbers

Page 12: COMP589 (1)

Bubble Sort - CICM Metric CICM = WICS * Wc

Where:

WlCS = Sum of weighted information count of all the lines in the software

Wc = Total cognitive weight of software

WlCS = 2/19 + 2/18 + 2/17 + 1/16 + 7/15 + 1/14 + 8/13 + 5/12 + 3/11+ 5/10 + 4/9 + 1/8 + 0 + 0 + 2/5 + 0 + 0 + 0 + 0 + 0

WlCS = 3.71 Wc = 24

CICM = 3.71 * 24 = 89.04

Page 13: COMP589 (1)

Objective

To study the relationship between the three cognitive complexity metrics and to find out which is the best metric to be used in the real world

Page 14: COMP589 (1)

What did they measure?

Ten different programs were testedAll written in JavaNone were similar to each other

Page 15: COMP589 (1)

Programs To Be MeasuredBlink.javaBubbleSort.javaClass2.javaCoalescedChainingApp.javaCollisionExperiment.javaFactMain.javaFibonacciMain.javaJumpingBox.javaLauncherThread.javaListStack.java

Page 16: COMP589 (1)

SurveyTo get an expert opinion of the complexities of each program:

30 software developers with 5+ years experience from five leading IT organizations in Sri Lanka

Each ranked the programs on a scale between 1-10

1 being the least complex10 being the most complexAll other programs fall in between

Page 17: COMP589 (1)

CFS Values For The 10 Programs Program CFS

Blink.java 22

Bubblesort.java 84

Class2.java 10

CoalescedChainingApp.java 171

CollisionExperiment.java 92

FactMain.java 12

FibonacciMain.java 18

JumpingBox 270

LauncherThread.java 24

ListStack.java 75

Page 18: COMP589 (1)

CWCM Values For The 10 Programs Program CWCM

Blink.java 22

Bubblesort.java 69

Class2.java 10

CoalescedChainingApp.java 57

CollisionExperiment.java 23

FactMain.java 12

FibonacciMain.java 18

JumpingBox 45

LauncherThread.java 6

ListStack.java 25

Page 19: COMP589 (1)

CICM Values For The 10 Programs Program CICM

Blink.java 122.54

Bubblesort.java 311.88

Class2.java 36.41

CoalescedChainingApp.java 326.61

CollisionExperiment.java 115.46

FactMain.java 42.24

FibonacciMain.java 73.62

JumpingBox 170.55

LauncherThread.java 32.22

ListStack.java 43.5

Page 20: COMP589 (1)
Page 21: COMP589 (1)

ConclusionCWCM had the lowest correlation (0.503)CICM had the second lowest correlation (0.588)CFS had the highest correlation (0.903)

Based off these results, CFS is the most suitable cognitive complexity metric to be used in the real world

Page 22: COMP589 (1)

The End

Questions, comments, suggestions?