Metrics

Lack of Cohesion Of Methods (LCOM)

Lack of Cohesion of Methods (LCOM) is a measure of cohesiveness of a class. The low LCOM value means the methods in a class is authored to achieve a common goal. Thus, a low LCOM value is desirable as it indicates good encapsulation. LCOM is measured in percent (%). Example:…

0
Read More

Access To Foreign Data (ATFD)

The Access To Foreign Data (ATFD) is the number of attributes from unrelated classes that are accessed directly or by invoking accessor methods. High ATFD is usually associated with low cohesion and high coupling. Example: ATFD is 2 for below class. private static class KeySelector3 implements KeySelector<tuple3<integer, long,=”” string=””>, Tuple2<integer,…

0
Read More

Number of Accessor Methods (NOAM)

The Number of Accessor Methods (NOAM) is the total number of accessor methods (getters and setters) of a class (or component). Example: NOAM is 2 for below code. public class Employee { private int number; public int getNumber() { return number; } public void setNumber(int newNumber) { number = newNumber;…

0
Read More

Executable Lines Of Code (ELOC)

Executable Lines Of Code (ELOC) is the number of executable lines of code in a class (component) or a function. This metric is also referred to as ‘Number Of Statements’ (NOS). The comment lines and empty lines are not counted. Components with high ELOC are often complex and tough to…

0
Read More

Locality of Attribute Accesses (LAA)

The Locality of Attribute Access (LAA) is the ratio of the number of attributes accessed from a method’s (or function’s) owner class to the total number of attributes accessed in the method. This is a subcomponent (method) level metric. Example: Consider method ‘M’ in class ‘A’ is accessing 2 attributes…

0
Read More

Foreign Data Providers (FDP)

Foreign Data Providers (FDP) is the total number of external components (or classes) from which foreign attributes are accessed. Here, these external classes are provisioning data. Ideally, all of the data should be locally available within the class to promote cohesion. Example: Consider method ‘M’ in class ‘A’ is accessing…

0
Read More

Number of Methods (NOM)

The number of methods (NOM) is the total number of methods (or functions) in a component (or class) or file. High NOM indicates a high complexity of the class. Example: NOM is 2 for below component. package org.apache.hive.hcatalog.pig; import com.google.common.collect.Lists; import junit.framework.Assert; import org.apache.hive.hcatalog.common.HCatConstants; import org.apache.hive.hcatalog.data.schema.HCatFieldSchema; import org.apache.hive.hcatalog.data.schema.HCatSchema; import org.apache.pig.ResourceSchema;…

0
Read More

Lines of Code Comments (LOC Comments)

LOC Comments is the number of comment lines in a component or class. Very few LOC Comments will affect understandability. New developers will find it hard to work with such components. Too many LOC Comments may be a result of un-intuitive implementation. Example: LOC Comments is 5 in below code.…

0
Read More

Number of Attributes (NOA)

NOA is the number of attributes of a component (or class). An attribute or field of a class is typically a constant or variable. Example:NOA is 7 for below component. /** * Autogenerated by Thrift Compiler (0.9.3) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT…

0
Read More