Automated Classification of Source Code Changes Based on Metrics Clustering in the Software Development Process
This paper presents an automated method for classifying source code changes by clustering eleven change metrics using k-means with cosine similarity, followed by expert mapping, which was validated on five software systems to achieve high classification purity and reduced review time.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you are the head chef of a massive, busy kitchen. Every day, hundreds of new ingredients arrive, old ones are thrown away, and recipes are tweaked. Your job is to keep the kitchen running smoothly, but you can't possibly taste every single change to see if it's a new dish, a fix for a burnt sauce, or just someone rearranging the spice rack.
This is exactly the problem software developers face. They write millions of lines of code, and every day, thousands of tiny "changes" happen. Some changes add new features (like a new dish), some fix bugs (like fixing a burnt sauce), some clean up old code (like throwing away expired ingredients), and some just reorganize things (like moving the spice rack).
Checking every single change manually takes forever. This is where Evgenii Knyazev's research comes in. He created a smart, automated "sous-chef" that helps organize these changes so human experts don't have to do all the heavy lifting.
Here is how his method works, broken down into simple steps:
1. The "Fingerprint" of a Change
Instead of reading the code like a book, Knyazev's system looks at the statistics of the change. Think of every code change as a person walking into a room. Instead of asking them their name, the system measures their "fingerprint" using 11 different rulers:
- How many lines of text did they add?
- How many did they delete?
- Did they make the logic more complicated?
- Did they add new "doors" (interfaces) or remove old ones?
These measurements create a unique metric vector—a digital ID card for that specific change.
2. The "Party Game" of Grouping (Clustering)
Once the system has the ID cards for thousands of changes, it plays a game of "Group the Similar."
- Imagine a giant dance floor.
- The system uses a mathematical rule called k-means (think of it as a very strict dance instructor) to group people who look similar.
- Crucially, it uses Cosine Similarity. Imagine two people are walking in the same direction but one is walking fast and the other slow. A normal ruler might say they are different because of the speed. But Knyazev's system only cares about the direction. If two changes are "walking in the same direction" (e.g., both are adding complexity), they get grouped together, even if one is a huge change and the other is tiny.
3. The Human "Captain"
Here is the clever part: The computer is great at grouping, but it doesn't know why the groups exist. It just sees that "Group A" looks like "Group B."
- The computer automatically sorts the thousands of changes into, say, 12 different piles (clusters).
- Then, a human expert (the "Captain") only needs to look at a tiny sample from each pile.
- The Captain says, "Ah, this pile is mostly 'Bug Fixes'," and "That pile is mostly 'New Features'."
- Once the Captain labels the piles, the computer automatically labels every single change in those piles.
Why This is a Big Deal
In the past, if a developer wanted to review 2,000 changes, they might have to read all 2,000.
With this method:
- The computer does the heavy lifting of sorting.
- The human expert only needs to review a tiny fraction (in the paper's example, they only looked at 73 changes out of 2,069 to teach the computer how to sort the rest).
- The result is that 75% of the changes are correctly sorted automatically.
The Real-World Test
Knyazev tested this on real software projects, including Subversion (a tool for managing code) and NHibernate (a tool for connecting databases).
- The Result: The system worked like a charm for standard changes. It successfully reduced the time experts spent reviewing code by a huge margin.
- The Limitation: If a single change is a "monster" that does everything at once (adds a feature, fixes a bug, and cleans up code all in one go), the system gets confused. It's like a person who is wearing a chef's hat, a firefighter's jacket, and a construction vest all at once—the system doesn't know which group to put them in.
The Bottom Line
This paper proposes a hybrid approach: Let the computer do the boring, repetitive sorting based on math, and let the human expert do the high-level decision-making. It's not about replacing the human; it's about giving the human a superpower to see the big picture without getting lost in the weeds.
In short: It turns a chaotic pile of code changes into organized, labeled folders, saving developers hours of work and letting them focus on building better software.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.