Code quality and technical debt

Coupling between objects

Also known as Coupling between objects, Coupling between objects in software engineering

By WeavePublished 1 min read

Definition

A count of relationships a class or object has with other classes or objects.

What it means

Coupling between objects, often called CBO, estimates how many distinct classes a class is connected to through method calls, fields, parameters, inheritance, or other configured relationships. It highlights classes that know about many collaborators. The definition must be fixed before comparing results across tools or languages.

Example

A controller directly constructs repositories, formatters, clients, validators, and audit writers. Its high coupling suggests that orchestration responsibilities and construction concerns may be separated for easier testing.

Limitations

A coupling count can rise because of legitimate composition or generated framework code. It says nothing about whether collaborators are stable or whether the class is difficult to understand. Pair it with cohesion, change history, and test design.

How to use the signal

Weave can show whether high-CBO classes generate larger pull requests or repeated review comments. Use the static-analysis report for the number and Weave’s history for prioritization, not as a replacement for design judgment.

How this relates to Weave

Weave can show whether high-CBO classes generate larger pull requests or repeated review comments. Use the static-analysis report for the number and Weave’s history for prioritization, not as a replacement for design judgment.

Explore Engineering intelligence

Sources and further reading

  1. SonarSource code metrics and analysis documentation