Percent Lack Of Cohesion is one of the source-code metrics Understand computes across 17+ languages — browse them in the GUI, export and track them, or script them with the Python API.
Percent Lack Of Cohesion
API ID: PercentLackOfCohesionAlso Known As: LCOM2, Lack of Cohesion in Methods (LCOM/LOCM)
Languages: Ada, Basic, C#, C++, Java, Pascal
Targets: Classes, Packages
100% minus the average cohesion for package entities.
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's instance variables and subtract from 100%. A lower percentage means higher cohesion between class data and methods.
Also known as Chidamber & Kemerer - Lack of Cohesion in Methods (LCOM/LOCM); LCOM2.
- Ada: Package
- Basic: Class, Struct
- C#: Class, Struct
- C++: Class, Struct, Union
- Java: Class, Interface
- Pascal: Class, Interface
- This metric can be disabled from "Project Configuration/Metrics/Object Orientated" with the "Show coupling and cohesion metrics" option.