Understanding Code Changes

Boaz Dremer Updated by Boaz Dremer

Understanding Code Changes


Code changes is a metric measures the changes that are done in the code base over time. It include either new code or refactored code and counted in number of code lines that were changed over time.

Code changes is an important metric because it gives indication regarding the size of a task and the risk level this task holds. The bigger the code changes number the higher risks that it presents. This metric is also important as one of the metrics that follow the throughput and productivity of individual/team/organization over time.

Code Changes Types

There are 2 types of code changes that LinearB is measuring:

  1. Effective (Actual) Code Changes - Effective code changes are the changes between base and the head commit of the branch. So basically it is the difference between the "current" state of the branch (or if the branch was merged, the merge commit) and the base of the branch. Measuring this way takes in to account only the effective (actual) changes that were done in the branch and ignores all the intra-commit changes that might fade out during the work on the branch.
  2. Process Code Changes - Process code changes are the cumulative code changes between each commit in the branch. In this metric we are comparing each commit to the previous commit and accumulate the changes in this commit to the total commits we accumulated thus fur.


Let's say there are 2 branches in our code base the first branch is the "master" branch (orange). The second branch, is the new feature branch - "fb" (blue) in "fb" there were 4 commits before it was merged back to "master". in "fb" commits we measured the following changes:

  • Commit 1 - Added 30 new lines of code
  • Commit 2 - Added 22 new lines of code
  • Commit 3 - We changed 5 lines that were added in commit 2
  • Commot 4 - We deleted 10 lines that were added in commit 1

Calculating process changes:

Commit 1 - 30 changes, commit 2 -22 changes, commit 3 - 5 changes, commit 4 - 10 changes

Total Process changes = 30 + 22 + 5 + 10 = 67 process changes

Calculating effective changes

Comparing the last commit changes to the base we see a change in: 30 (new lines) + 22 (new lines) + 0 (changing same lines) - 10 (removing previously added lines) = 42 Effective changes

How did we do?

Work Breakdown Terms

Quality Code Metrics Explained