Class LCOM2

LCOM2 (Chidamber & Kemerer, 1994 - revised)

Formula: LCOM2 = 1 - (Σ(MF) / (M * F))

Where:

  • M is the number of methods in the class
  • F is the number of fields in the class
  • MF is the number of methods that access each field
  • Σ(MF) is the sum of MF over all fields

Returns a value between 0 and 1:

  • 0: perfect cohesion (all methods access all fields)
  • 1: no cohesion (no method accesses any field)

Implements

Constructors

Properties

Methods

Constructors

Properties

name: string = 'LCOM2'
description: string = 'Lack of Cohesion of Methods (Chidamber & Kemerer, 1994) - Normalized measure of method-field relationships'

Methods