Code quality and technical debt

Divergent change

Also known as Divergent change, Divergent change in software engineering

By WeavePublished 1 min read

Definition

A code smell in which one module changes for many unrelated reasons.

What it means

Divergent change means a single class or module attracts edits from several independent concerns. The smell suggests that responsibilities with different owners or release rhythms may be mixed together. It complements shotgun surgery: divergent change is many reasons in one place, while shotgun surgery is one reason in many places.

Example

A user service changes for authentication policy, profile formatting, and notification templates. Separate collaborators can align each responsibility with its owner and reduce unrelated review scope.

Limitations

A central coordinator may legitimately change for several steps in one workflow. Splitting it can add indirection and obscure sequencing. Examine commit themes, ownership, and tests before acting.

How to use the signal

The strongest evidence is usually a repeated pattern of unrelated owners or policies converging on one module over time.

Use commit themes and owners to distinguish unrelated responsibilities from one cohesive workflow that naturally evolves together.

Weave can help segment divergent-change hotspots by author, review depth, and rework. Use repository history for the pattern and Weave for its workflow consequences.

How this relates to Weave

Weave can help segment divergent-change hotspots by author, review depth, and rework. Use repository history for the pattern and Weave for its workflow consequences.

Explore Engineering intelligence

Sources and further reading

  1. SonarSource code metrics and analysis documentation