MORCoRA: Multi-Objective Refactoring Recommendation Considering Review Availability

This paper proposes MORCoRA, a multi-objective search-based technique that recommends code quality-improving refactoring sequences along with suitable reviewers by simultaneously optimizing for expertise and workload availability to ensure the refactorings can be promptly reviewed.

Lei Chen, Shinpei Hayashi

Published Tue, 10 Ma
📖 4 min read☕ Coffee break read

Imagine you are the captain of a busy ship (a software project). You realize the ship needs some repairs and upgrades to sail smoother and faster. You have a brilliant engineer (an AI tool) who can tell you exactly which planks to replace and how to rearrange the cargo to make the ship better.

However, there's a catch: You can't just fix the ship while it's sailing. You need to get permission from your crew, and more importantly, you need to find crew members who actually know how to fix that specific part of the ship and aren't currently drowning in other work.

This is the problem the paper MORCoRA solves.

Here is the breakdown in simple terms:

1. The Problem: The "Perfect Plan" That Never Happens

In the world of software, developers often use "Search-Based Refactoring." Think of this as a GPS that plots the perfect route to fix code. It looks for ways to make the code cleaner, faster, and less buggy.

But in the real world, a perfect plan is useless if:

  • The Reviewer is clueless: You ask a chef to review a mechanic's engine repair. They don't know enough to say "yes" or "no."
  • The Reviewer is too busy: You ask the only mechanic on the ship to review the repair, but they are already fixing the engine, painting the deck, and cooking dinner. They will ignore your request or delay it forever.

The paper argues that most AI tools only look for the "perfect repair" but ignore whether anyone is actually available to approve it. This leads to great ideas that sit in a drawer, never getting applied, while the ship's quality slowly rots.

2. The Solution: MORCoRA (The Smart Captain's Assistant)

The authors created a new tool called MORCoRA. Instead of just looking for the best repair, it looks for the best repair that can actually get approved.

It balances three goals, like a chef trying to make a meal that is:

  1. Delicious (Code Quality): The code must actually get better.
  2. Safe to Eat (Semantic Coherence): The fix must make sense. You can't move a "brake pedal" to the "steering wheel" just because it looks neat; the car won't work.
  3. Ready to Serve (Review Availability): This is the new, special ingredient. The tool checks:
    • Who knows this code? (Expertise)
    • Who has free time right now? (Workload)

If the tool finds a great fix but the only expert is swamped with 10 other tasks, MORCoRA says, "Nope, let's skip this one and find a different fix that a busy-but-capable person can handle."

3. How It Works (The Recipe)

The tool uses a "genetic algorithm." Imagine a garden where you are trying to grow the perfect plant.

  • You start with 100 random ideas for fixes.
  • You test them against your three goals (Taste, Safety, Availability).
  • You keep the best ones, mix their "DNA" (combine parts of different fixes), and mutate them (make small random changes).
  • Over time, the garden fills with plants that are delicious, safe, and ready to be picked by a gardener who isn't too busy.

4. The Results: Does It Work?

The researchers tested this on six popular software projects (like the ones you might use on your phone or computer).

  • The "Old Way" (Ignoring Availability): Found great fixes, but often suggested them to people who were too busy or didn't know the code. The "approval rate" was low.
  • The "MORCoRA Way": Found fixes that were slightly less "perfect" in a theoretical sense, but were 433% more likely to actually get approved because they matched the right person with the right free time.

The Analogy:

  • Old Tool: "Here is the best recipe for a cake! Give it to the head chef!" (But the head chef is asleep and the sous-chef doesn't know how to bake). Result: No cake.
  • MORCoRA: "Here is a very good recipe. Give it to the sous-chef who is currently on a break and knows how to bake." Result: A cake gets made.

5. The Big Takeaway

The paper concludes that we need to stop treating software development like a math problem where only the "best answer" matters. We have to treat it like a team sport.

If you want to improve your software, you can't just find the best fix; you have to find the best fix that your team can actually handle right now. MORCoRA is the tool that helps you do exactly that, ensuring that good ideas don't get stuck in "review purgatory."