Software metrics catched by dotEASY
dotEASY catch more than 60 software metrics in the following categories:
Afferent Couplings (Ca)Description: Number of classes located outside a namespace that depend on classes located within the analyzed namespace (The first ones define local variables, parameters, attributes, etc of the last ones). System Classes are not considered.
Note: You can calculate CA by counting the number of "using" sentences for a namespace, but you should also consider multiple classes declared in a single file.
Efferent Coupling (Ce)Description: It is the total number of classes inside a namespace that depend on classes located outside the analyzed namespace. System classes are not considered.
Note: You can calculate Ce by counting the classes inside a namespace that have a "using" sentence of an external namespace (System usings are not considered). You should also consider multiple classes defined inside a single file.
Instability (I)Description: I = (Ce ÷ (Ca+Ce)). This metrics range is [0,1]. I=0 indicates maximum stability of a namespace. I=1 indicates maximum instability of a namespace.
Abstractness (A)Description: It is the total number of Interfaces and abstract classes over the total number of classes and interfaces of the namespace.
Distance (D)Description: It is defined as the balance between Instability and Abstractness. It can also be defined as the particular distance of a namespace from the main sequence.
Formula: D = |(A+I-1)/2|
Distance (normalized) (Dn)Description: It is defined as the normalized balance between Instability and Abstractness. It can also be defined as the particular distance of a namespace from the main sequence.
Formula: Dn = |(A+I-1)|
Number of types (NOT)Description: Total number of classes and interfaces of a namespace. It is calculated by counting all the classes and interfaces defined within the namespace.
Number of abstract Types (NOTa)Descrption: Total number of abstract classes and interfaces of a namespace. It is calculated by counting all the abstract classes and interfaces defined within the namespace.
Number of Concrete Types (NOTc)Descrption: Total number of concrete classes of a namespace. It is calculated by counting all the concrete classes defined within the namespace.
Number of Exported Types (NOTe)Description: Total number of classes and interfaces of a namespace that are available for clients defined outside the namespace. It can also be defined as the total number of non-internal classes and interfaces of a namespace.
Number of Classes (NOC)Description: Total number of concrete and abstract classes defined in a namespace.
Specialization IndexDescription: This index is calculated using the following formula:
Redefined methods of the class * hierarchy level * total number of methods of the class
Redefined methods of a class are: redefined methods and new method definitions.
Hierarchy level is equivalent to DIT. Number 1 in hierarchy level corresponds to a base class defined at the top of the structure.
Depth of Inheritance Tree (DIT)Description: Maximum distance from a node to the root of the inheritance tree.
It is also referred as number of ancestors of a class.
Ancestor is defined as an entity from which the class or interface inherits. It doesnt consider the "implements" relationship. Because of that, an interface isnt a class ancestor.
Number of children (NOC) or Number Of Child Classes (NOOCC)Description: Total number of direct children of a particular class. It is calculated by counting all the direct successors of a class.
Number of base classes (NTLC)Description: Total number of top-level (base classes of a hierarchy) classes within a Project. It is calculated by counting all the top-level classes that inherit directly form Object base class.
Coupling between objects (CBO)CBO is defined as the number of non-inherited classes who are associated with target class.
It is calculated by counting the number of types that are used in attributes, parameters, return types, local variables and throw declarations. Types from which attributes and methods are used are also considered.
Primitive types and system types are no considered,
Lack of Cohesion of methods (LCOM)LCOM is calculated by using the following procedure:
First, for each attribute of the class, you calculate the percentage of methods that utilize the attribute.Second, the average of all the results obtained is calculated.
Finally, the result is subtracted from 100. Description: Response for a class is the total number of local methods plus the total number of remote methods.The sum of local methods includes inherited methods
Observations:- Methods are counted only once.Data Abstraction Coupling (DAC)- Private methods (only accessible from their classes) are counted if and only if they are referenced from the public methods.
- Method calls made by inherited methods are not counted.- Method calls made by remote methods are not considered.
Description: Total number of referenced types used in attributes declaration. All attributes are considered, regardless of their scope . Primitive types, System types and super types are not considered.
MIC - Method Invocation CouplingDescription: Relative number of classes that receive messages from a class.
Formula: MICnorm = nMIC / (N -1)where N is the total number of classes defined within the proyect and nMIC is the total number of classes that receive messages.
nMIC is calculated by counting the classes that have a dependency with the analyzed class. Dependencies are method calls, or variable declaration of any type.N is calculated by counting the classes defined within the project.
Number of Interfaces (NOI)Description: Number of interfaces that are implemented by a class.
The sum of the interfaces Implemented by a class
Weighted methods per class (WMC)Description: Result of the sum of all the methods ciclomatic complexity of a class. Inherited methods are not considered.
Description: Total number of lines of code of a class. Blank and comment lines are included on the count. The first line that is counted is the declaration of the class
Description: Total number of attributes of a class. Inherited attributes are not considered.
Number Of Public Attributes (NOAp)
Description: Total number of public and protected attributes of a class. Inherited attributes are not considered.
Number Of Attributes within Inherited Attributes (NOAi)
Description: Total number of attributes of a class including Inherited attributes.
Number Of Constructors (NOCON)
Description: Total number of constructors of a class.
Description: Total number of members of a class, including attributes, operations, etc. Inherited members can be considered optionally. (DotEASY doesnt consider them in this metric)
Number Of Members within Inherited Members (NOMi)
Description: Total number of members of a class, including attributes, operations, etc. Inherited members are considered.
Description: Total number of operations of a class. Inherited operations are not considered.
Number Of Public Operations (NOOp)
Description: Total number of public and protected operations of a class. Inherited operations are not considered
Number Of Only Public Operations within Inherited Operations (NOOOpi)
Description: Total number of public (and only public) operations of a class. It also considers inherited operations
Number Of Operations within Inherited Operations (NOOi)
Description: Total number of operations of a class, including inherited operations.
Number Of Overridden Methods (NOOM)
Description: Total number of overridden methods of a class. It is calculated by counting all the overridden statements on all methods of a class.
Description: Percentage of public and protected attributes over the total number of attributes of a class. Inherited attributes are not considered
Description: Number of classes (or methods) that can access the attributes of another class, violating in this way the encapsulamiento of this class.
Percentage of Private Members (PPrivM)
Description: Percentage of private (attributes, methods, etc) members of a class
Percentage of Public Members (PPubM)
Description: Percentage of public (attributes, methods, etc) members of a class
Description: Total number of lines of code of a class divided by the total number of methods.
Maximum Size Of Operation (MSOO)
Description: Maximum size o fan operation of a class, measuring the size of an operation by it ciclomatic complexity.
Average number of parameters of methods of a class.
Description: Average number of parameters for all the methods of a class. It is calculated by taking the total number of parameters of all the methods of the class, and dividing them by the total number of methods of the class.
Maximum Number Of Parameters (MNOP)
Description: Maximum number of parameters used in a method in a class.
Definition: Total number of remote method calls in a class. It is calculated by processing all methods (including constructors) of a class and counting all the remote methods calls. A remote method is a method not defined within the class or it superclasses.
Lines of Code (LOC)Description: Total number of lines of code written in a code block. Blank and comment lines are included on the count. The first line that is counted is the signature of the method
Description: Total number of commented lines in a code block
Ciclomatic complexity is defined as the number of edges nodes +2. It can also be simplified by defining it as the number of binary decisions defined in the control flow.
Note: In c# binary decisions are the following: if, while, for, foreach, case, catch, and (&&) y or (||).
Description: Total number of method calls within a method. It is calculated by counting all the method calls (whether they are remote or not). Method calls inside a catch blok or a finally block are also considered.
Description: Total number of parameters of a method. If the number of parameters can´t be calculated, -1 is assigned.
Description: Total number of local variables of a method. It is calculated by counting the number of variables defined within the method scope.
Lines of Code NCNB (no comment no blank)Description: Total lines of code of a method. Blank and commented lines are not considered. The first line counted is the signature of the method.
Description: Percentage of commented lines of a method.
Formula: CL (comment lines) / LOC
Description: Percentage of commented lines over the total non-commented lines of a method.
Formula: CL (comment lines) / (LOC CL)
Description: Total number of of executable sentences of the method. Executable sentences are C# sentences.
EXECswitch - Executable sentences switch
Description: Total number of switch sentences of a method. It is calculated by counting the number of switch sentences of a method.
EXECif - Executable sentences if
Description: Total number of if or elseif sentences of a method. It is calculated by counting the number of if and elseif sentences of a method.
EXECwhile- Executable sentences while
Description: Total number of while or do while sentences of a method. It is calculated by counting the number of while and do while sentences of a method.
Description: Total number of for or foreach sentences of a method. It is calculated by counting the number of for and foreach sentences of a method.
PreprocessDescription: Total lines of preprocessor directives within a project. It is calculated by counting the total preprocessor directives of a project. The directives are extracted from the .cs files.
C# preprocessor directives are the following:
using
#if
#else
#elif
#endif
#define
#undef
#warning
#error
#line
#region
#endregion
Description: Total number of files within a Project. It is calculated by obtaining the total number of .cs files of a Project.
Description: Total number of files within a Solution. It is calculated by obtaining the total number of .cs files of a Solution.
Description: Total number of LOC of The entire Project. It is calculated by counting the number of lines of code of all the ,cs files that belong to the Project.
LOC Lines of code (Solution)
Description: Total number of LOC of The entire Solution. It is calculated by counting the number of lines of code of all the ,cs files that belong to the Solution.
Description: Length (measured in total lines lines, not only lines of code) of a file. It is calculated by counting all the lines from the Begin Of File (BOF) until the End of File (EOF)
Description: Length (measured in characters) of a line. It is calculated by counting all the characters in every line of the file. Blank chacracters are not considered. (Note: Blank characters are the following: , \t,\n.