scitools.com

← Metric catalog

Coupled Classes Modified 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.

Coupled Classes Modified

API ID: CountClassCoupledModified
Languages: Basic, C#, Java, Pascal, Python
Targets: Classes

Number of other non-standard classes coupled to.

Same as Coupled Classes (Chidamber & Kemerer's CBO), except coupling to standard-library classes doesn't count — only coupling to other user-defined classes does.

For example:


class Helper {

  public int value;

  public void doWork() {
    value++;
  }

}

class Coupler {

  public void useHelper() {
    Helper h = new Helper();
    h.doWork();

    java.util.ArrayList<String> list = new java.util.ArrayList<String>();
    list.add("test");
    System.out.println(list.size());
  }

}

Coupler uses a type, data, or member from five different classes: the user-defined Helper, plus four standard-library ones (java.util.ArrayList, String, System, and java.io.PrintStream, the last used implicitly via System.out), giving CountClassCoupled = 5. Only Helper is non-standard, so CountClassCoupledModified = 1.

See Coupled Classes to also count coupling to standard-library classes.

Targets By Language: Configuration: