Question: CK calculates class - level and method - level code metrics in Java projects by means of static analysis ( i . e . no
CK calculates classlevel and methodlevel code metrics in Java projects by means of static analysis ie no need for compiled code Currently, it contains a large set of metrics, including the famous CK:
CBO Coupling between objects: Counts the number of dependencies a class has. The tools checks for any type used in the entire class field declaration, method return types, variable declarations, etc It ignores dependencies to Java itself eg java.lang.String
CBO Modified Coupling between objects: Counts the number of dependencies a class has. It is very similar to the CKTool's original CBO. However, this metric considers a dependency from a class as being both the references the type makes to others and the references that it receives from other types.
FANIN: Counts the number of input dependencies a class has, ie the number of classes that reference a particular class. For instance, given a class X the fanin of X would be the number of classes that call X by referencing it as an attribute, accessing some of its attributes, invoking some of its methods, etc.
FANOUT: Counts the number of output dependencies a class has, ie the number of other classes referenced by a particular class. In other words, given a class X the fanout of X is the number of classes called by X via attributes reference, method invocations, object instances, etc.
DIT Depth Inheritance Tree: It counts the number of "fathers" a class has. All classes have DIT at least everyone inherits java.lang.Object In order to make it happen, classes must exist in the project ie if a class depends upon X which relies in a jardependency file, and X depends upon other classes, DIT is counted as
NOC Number of Children: It counts the number of immediate subclasses that a particular class has.
Number of fields: Counts the number of fields. Specific numbers for total number of fields, static, public, private, protected, default, final, and synchronized fields.
Number of methods: Counts the number of methods. Specific numbers for total number of methods, static, public, abstract private, protected, default, final, and synchronized methods. Constructor methods also count here.
Number of visible methods: Counts the number of visible methods. A method is visible if it is not private.
NOSI Number of static invocations: Counts the number of invocations to static methods. It can only count the ones that can be resolved by the JDT
RFC Response for a Class: Counts the number of unique method invocations in a class. As invocations are resolved via static analysis, this implementation fails when a method has overloads with same number of parameters, but different types.
WMC Weight Method Class or McCabe's complexity. It counts the number of branch instructions in a class.
LOC Lines of code: It counts the lines of count, ignoring empty lines and comments ie it's Source Lines of Code, or SLOC The number of lines here might be a bit different from the original file, as we use JDTs internal representation of the source code to calculate it
LCOM Lack of Cohesion of Methods: Calculates LCOM metric. This is the very first version of metric, which is not reliable. LCOMHS can be better hopefully you will send us a pull request
LCOMLack of Cohesion of Methods: This metric is a modified version of the current version of LCOM implemented in CK Tool. LCOM is a normalized metric that computes the lack of cohesion of class within a range of to Then, the closer to the value of LCOM in a class, the less the cohesion degree of this respective class. The closer to the value of LCOM in a class, the most the cohesion of this respective class. This implementation follows the third version of LCOM defined in
Reference: HendersonSellers, Brian, Larry L Constantine and Ian M Graham. Coupling and cohesion towards a valid metrics suite for objectoriented analysis and design Object Oriented Systems :
TCC Tight Class Cohesion: Measures the cohesion of a class with a value range from to TCC measures the cohesion of a class via direct connections between visible methods, two methods or their invocation trees access the same class variable.
LCC Loose Class Cohesion: Similar to TCC but it further includes the number of indirect connections between visible classes for the cohesion calculation. Thus, the constraint LCC TCC holds always.
Quantity of returns: The number of return instructions.
Quantity of loops: The number of loops ie for, while, do while, enhanced for
Quantity of comparisons: The number of comparisons ie and Note: is only available in
Quantity of trycatches: The number of trycatches
Quantity of parenthesized expressions: The number of expressions inside parenthesis.
String literals: The number of string literals eg "John Doe" Repeated strings count as manytimes as they appear.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
