-
Notifications
You must be signed in to change notification settings - Fork 2
ClassComplexity Measure
Also called Cognitive Complexity, this measure computes the cognitive weight of a Java Architecture. The cognitive weight represents the complexity of a code architecture in terms of maintainability and code understanding.
- value : Integer
- Property1 : The link of the SVN repository of the java project
- Property2 : The login of the SVN repository
- Property3 : The password associated to the login
No dependency
The implementation of that measure computes the cognitive weight of a Java project by adding the cognitive weight of each method of each class. In order to compute the cognitive weight of a method, we focus on the nested level of conditional statements/blocks (if-then-else) and the for and foreach loops. As shown in the pseudocode below, each level is associated with a weight (a number) and thus all these weights are summed. Therefore, we add the weights of all methods to have the cognitive weight of a class.
CognitiveWeight(statements block, integer weight, integer level):
For each statement S of block
If S is conditional statement or for statement of foreach statement:
level2=level+1
weight2=weight+level
S1 = block1 of S
CognitiveWeight(S1,weight2,level2)
End If
End For
End
The result of the cognitive measure is the number representing the cognitive weight of the project, in other terms, it returns the sum of the weight of each method of each class of the project provided as the scope parameter.