2. 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
4. Why is this important?
Unlike new software development,
maintaining and expanding existing code is
extremely difficult
Prone to cost overruns, delays, and defects
5. 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
6. The Big 3: Which is best?
Cognitive Weight Complexity Measure (CWCM)
Cognitive Functional Size (CFS)
Cognitive Information Complexity Measure (CICM)
7. Cognitive Weight Complexity Measure
(CWCM)
Considers only the cognitive weights (Wc) of
the basic control structures of the software
Language independent
Simple and easy to calculate
Gives the complexity in small numbers
9. Cognitive Functional Size (CFS)
Based on cognitive weights of basic control
structures and number of inputs and outputs
Easy to calculate
Does not rely on the implementation
technologies
Uses sound principles
10. 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
11. 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 calculate
Gives complexity in larger numbers
12. 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
13. 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
14. What did they measure?
Ten different programs were tested
All written in Java
None were similar to each other
15. Programs To Be Measured
Blink.java
BubbleSort.java
Class2.java
CoalescedChainingApp.java
CollisionExperiment.java
FactMain.java
FibonacciMain.java
JumpingBox.java
LauncherThread.java
ListStack.java
16. Survey
To 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 complex
10 being the most complex
All other programs fall in between
17. 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
18. 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
19. 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
20.
21. Conclusion
CWCM 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