Object oriented metrics in testing:
OBJECT-ORIENTED METRICS AND MEASURES
As object-oriented approach emerged to support major applications, the effectiveness of applying traditional software metrics to object-oriented systems was challenged. The object-oriented design approach gives opportunity to classify metrics naturally.
The classification captures object-oriented software features and properties hierarchically. It begins with the high-level characteristics of an object-oriented system and moves down to the low-level characteristics.
Source code size metrics: Traditional metrics which are applied to object oriented software give insight into an overall system size and allow comparing systems and evaluating productivity. They can also be used as a refactoring effectiveness indicator.
Lines of Code (LOC) metric is most common software project measure. The metric becomes a baseline to measure the degree of work performed on a project and it is used to create time and cost estimates.
Effective Lines of Code Metric (eLOC) is a measure of all lines that are not comments, blanks or standalone braces or parenthesis. This metric more closely represents the quantity of work performed.
Comment Line and Comment Percent (or Comment to Code Ratio) is a degree of commenting within the source code. It measures the care taken by programmers to make the source code and algorithms understandable. Poorly commented code makes the maintenance activities an extremely expensive. Recommended minimum is 20%.
Blank Line and White Space Percent Metric is the number of blank lines within source code. It indicates the readability of product. And File Count Metric counts the files processed and generates metrics based on the file extension. It provides the distribution of the source code types, source code types and distribution of the specifications to the implementations.
Procedural metrics: Cyclomatic Complexity is a popular procedural (called also function) software metric equal to the number of decisions that can be taken in a procedure A decision is defined as an occurrence of keywords such as: "while", "for", “for each”, “continue”, "if", "case", "go to", “try” and “catch” within the function. Cyclomatic Complexity is the sum of these constructs.
That metric helps to identify software need of inspection or redesign, and also to allocate resources for evaluation and test.
Class metrics: Class metrics describe structure of a class and relationship between classes. The volume of a class is a basic size
measure connected with the amount of information inside it. The class volume can be measured by Number of Variables and by
Number of Methods. Also Average LOC per Class and per Method metrics can provide insight into the average module size in the system. Method metrics are used to estimate effort for testing early. Those metrics can be measured by Number of Parameters per Method, Weighted Methods per Class, Maximum Nesting Level, and Method Rank. Number of Parameter per Method counts parameters of a method and also references.
Afferent Coupling and Efferent Coupling at method level are another object coupling metrics. Afferent Coupling for a particular method is the number of methods that depends directly on it and the Efferent Coupling for a particular method is the number of methods it directly depends on. Afferent Coupling is an indicator for the responsibility. The higher this value is the higher is the element’s responsibility. Efferent Coupling means that a element depends on several other implementation details and it makes it instable.
Therefore it is good practice to keep the Efferent Coupling for all artefacts at a minimum.
Inheritance metrics :The inheritance relationships characteristic between classes and their parents indicate to a designer where
changes would improve the development. The metrics connected to classes inheritance should take into account both the depth and breadth of the relationships. The Height of Inheritance Tree metric is counted as the maximum number of nodes from the class node
to the root of the inheritance hierarchy. The deeper within the hierarchy, the more methods the class can inherit, increasing its complexity.