Visualize Your Code

Support

What Metrics does Understand have?

The below metrics included with Understand have evolved over many years to accommodate common customer requests. However, we recognize that you may need something different. To help you develop custom metrics there is a full API interface to the Understand database as well as a fully developed plugin mechanism.

Coupling Between Objects

API Name: CountClassCoupledResearch: Chidamber & Kemerer – Coupling Between Objects (CBO)Description: The Coupling Between Object Classes (CBO) measure for a class is a count of the number of other classes to which it is coupled. Class A is coupled to class B if class A uses a type, data, or member from class B. This metric is also referred to as Efferent Coupling (Ce). Any number of couplings to a given class counts as 1 towards the metric total

Chidamber & Kemerer suggest that:1) Excessive coupling between object classes is detrimental to modular design and prevents reuse. 2) Inter-object class couples should be kept to a minimum. 3) The higher the inter-object class coupling, the more rigorous testing needs to be.Metric available for:

Number of Children

API Name: CountClassDerivedResearch: Chidamber & Kemerer – Number of Children (NOC)Description: Number of immediate subclasses. (i.e. the number of classes one level down the inheritance tree from this class).Metric available for:

Inputs

API Name: CountInputResearch: FANINDescription: The number of inputs a function uses plus the number of unique subprograms calling the function. Inputs include parameters and global variables that are used in the function, so Functions calledby + Parameters read + Global Variables read. Of the two general approachs to calculating FANIN (informational versus structural) ours is the informational approach.Metric available for:

Blank php lines

Source Lines of Code

API Name: CountLineCodeResearch: LOC, SLOCDescription: The number of lines that contain source code. Note that a line can contain source and a comment and thus count towards multiple metrics. For Classes this is the sum of the CountLineCode for the member functions of the class.Metric available for:

PHP Source Code Lines

Lines with Comments

API Name: CountLineCommentResearch: CLOCDescription: Number of lines containing comment. This can overlap with other code counting metrics. For instance int j = 1; // comment has a comment, is a source line, is an executable source line, and a declarative source line.Metric available for:

PHP Comment Lines

Inactive Lines

API Name: CountLineInactiveDescription: This is the number of lines that are inactive from the view of the preprocessor. In other words, they are on the FALSE side of a #if or #ifdef preprocessor directive.Metric available for:

PHP Lines

Outputs

API Name: CountOutputResearch: FANOUTDescription: The number of outputs that are SET. This can be parameters or global variables. So Functions calls + Parameters set/modify + Global Varibales set/modify. Of the two general approachs to calculating FANOUT (informational versus structural) ours is the informational approach.Metric available for:

Paths (Log10x)

API Name: CountPathLogDescription: The base 10 logarithm (Log10x) of the number of unique paths though a body of code, not counting abnormal exits or gotos through the code, truncated to an integer value.Metric available for:

PHP Executable Statements

Cyclomatic Complexity

API Name: CyclomaticResearch: McCabe Complexity (v(G))Description: McCabe Cyclomatic complexity as per the original NIST paper on the subject.Edges – Nodes + Connected Components McCabe also proved that the cyclomatic complexity of any structured program with only one entrance point and one exit point is equal to the number of decision points contained in that program plus one (refer to section V for the proof). Understand counts the keywords for decision points (FOR, WHILE, etc) and then adds 1. For a switch statement, each ‘case’ is counted as 1 and the ‘switch’ itselfs adds one to the final Cyclomatic Complexity count.Metric available for:

Modified Cyclomatic Complexity

API Name: CyclomaticModifiedDescription: Modified McCabe Cyclomatic complexity. The Cyclomatic Complexity except that each decision in a multi-decision structure (switch in C/Java, Case in Ada, computed Goto and arithmetic if in FORTRAN) statement is not counted and instead the entire multi-way decision structure counts as 1Metric available for:

Strict Cyclomatic Complexity

API Name: CyclomaticStrictDescription: Strict cyclomatic complexity. The Cyclomatic Complexity with logical conjunction and logical and in conditional expressions also adding 1 to the complexity for each of their occurrences. i.e. The statement if (a && b || c) would have a cyclomatic of 1 but a strict cycolmatic of 3Metric available for:

Essential Complexity

API Name: EssentialResearch: ev(G)Description: Essential complexity is the Cyclomatic complexity after iteratively replacing all well structured control structures with a single statement. Structures such as if-then-else and while loops are considered well structured. Understand calculate the essential complexity by removing all the structured subgraphs from the control graph and then calculating the complexity. A graph that has only the regular single entry/single exit loops or branches will be reducible to a graph with complexity one. Any branches into or out of a loop or decision will make the graph non-reducible and will have essentialcomplexity > 2. (You never get 2 since a graph with complexity 2 is always reducible to a graph with complexity 1).Metric available for:

Essential Strict Modified Complexity

API Name: EssentialStrictModifiedDescription: Strict Modified Essential complexity. The Cyclomatic complexity with short circuit operators (and then/or else) as unstructured but only adds one for all structured paths through case statements after graph reduction.Metric available for:

Knots

API Name: KnotsDescription: Measure of overlapping jumps. If a piece of code has arrowed lines indicating where every jump in the flow of control occurs, a knot is defined as where two such lines cross each other. The number of knots is proportional to the complexity of the control flow.Metric available for:

Max Essential Strict Modified Complexity

Depth of Inheritance Tree

API Name: MaxInheritanceTreeResearch: Chidamber & Kemerer – Depth of Inheritance Tree (DIT)Description: The depth of a class within the inheritance hierarchy is the maximum number of nodes from the class node to the root of the inheritance tree. The root node has a DIT of 0. The deeper within the hierarchy, the more methods the class can inherit, increasing its complexity. Metric available for:

Lack of Cohesion in Methods

API Name: PercentLackOfCohesionResearch: Chidamber & Kemerer – Lack of Cohesion in Methods (LCOM/LOCM)Description: 100% minus average cohesion for class data members. Calculates what percentage of class methods use a given class instance variable. To calculate, average percentages for all of that class’es instance variables and subtract from 100%. A lower percentage means higher cohesion between class data and methods.Metric available for:

Comment to Code Ratio

API Name: RatioCommentToCodeDescription: Ratio of number of comment lines to number of code lines. Note that because some lines are both code and comment, this could easily yield percentages higher than 100Metric available for: