Skip to content
advanced Phase 109 · Technical Debt

Prioritizing Technical Debt in Magento 2

Frameworks for assessing and prioritizing technical debt impact, including debt quadrants and prioritization models

45m
2 problems
Topic Progress 0%

Debt Impact Assessment

Measuring Debt Impact

The Interest Metaphor

Technical debt has a principal (original cost) and interest (ongoing cost):

Principal: Effort to fix the debt if addressed now
Interest: Additional effort required if debt is not addressed

Example:
- Quick hack to fix checkout: 2 hours
- Interest: 30 minutes per feature touching checkout
- After 20 features: 2 + (0.5 × 20) = 12 hours total
- Clean solution upfront: 8 hours
- Savings from debt: 12 - 8 = 4 hours wasted

Impact Dimensions

Dimension          | Low Impact          | High Impact
--------------------|--------------------|-------------------
Business           | Internal tool      | Customer-facing
Frequency          | Rarely touched     | Daily changes
Developer Hours    | 1 dev, 1 hour      | 10 devs, 1 week
Risk               | Easy rollback      | Data loss possible
User Experience    | Admin panel        | Checkout flow
Revenue            | No direct impact   | Sales pipeline

Debt Scoring Model

// Custom scoring example
class DebtScorer
{
    public function score(array $debt): int
    {
        return (
            $debt['business_impact'] * 3 +
            $debt['frequency'] * 2 +
            $debt['developer_hours'] * 2 +
            $debt['risk'] * 3 +
            $debt['user_impact'] * 2
        );
    }
}

// Scores:
// 0-20: Low priority
// 21-40: Medium priority
// 41-60: High priority
// 61+: Critical - address immediately

Technical Debt Quadrants

Martin Fowler's Debt Quadrants

                    Deliberate              Inadvertent
                ┌─────────────────────┬─────────────────────┐
  Reckless     │ "We don't have time │ "What's layering?"  │
                │  for design"        │                     │
                ├─────────────────────┼─────────────────────┤
  Prudent       │ "Ship now and deal  │ "Now we know how    │
                │  with consequences" │  we should have done│
                │                     │  it"                │
                └─────────────────────┴─────────────────────┘

Quadrant Examples in Magento

Deliberate + Reckless

// "We need this live by Friday"
$product->setData('custom_field', $value);
// No model, no validation, no API, hardcoded string

Deliberate + Prudent

// "Ship the MVP, refactor next sprint"
// Quick prototype with known limitations
// Planned technical debt ticket created

Inadvertent + Reckless

// Team doesn't know Magento best practices
$order->load($id);
$order->setData('status', 'complete');
$order->save();
// No service contract, direct data manipulation

Inadvertent + Prudent

// "Now we know how we should have done it"
// Original implementation was reasonable with what we knew
// Learning led to better architecture

Decision Matrix

Quadrant              | Action
----------------------|----------------------------------------
Deliberate + Reckless | Avoid at all costs, pay immediately
Deliberate + Prudent  | Track, schedule repayment
Inadvertent + Reckless | Learn, prevent recurrence, plan fix
Inadvertent + Prudent | Document learnings, refactor when possible

Prioritization Frameworks

The Debt Prioritization Matrix

Quadrant-Based Prioritization

                    High Impact on Features
                    ┌─────────────────────┬─────────────────────┐
  Easy to Fix       │                     │                     │
                    │   Quick Wins        │   High Value        │
                    │   (Do First)        │   (Schedule Soon)   │
                    ├─────────────────────┼─────────────────────┤
  Hard to Fix       │                     │                     │
                    │   Low Priority      │   Strategic Debt    │
                    │   (Backlog)         │   (Plan Properly)   │
                    └─────────────────────┴─────────────────────┘
                    Low Impact on Features

Cost of Delay Framework

// Calculate cost of delaying debt fix
$costPerDay = [
    'developer_blocked_hours' => 2,  // Hours lost daily
    'hourly_rate' => 75,
    'feature_delay_cost' => 500,      // Revenue impact
];

// Total daily cost
$dailyCost = (
    $costPerDay['developer_blocked_hours'] * $costPerDay['hourly_rate']
) + $costPerDay['feature_delay_cost'];

// $150 + $500 = $650/day cost of delay
// Fix immediately if daily cost > fix cost

RICE Scoring (Reach, Impact, Confidence, Effort)

Reach:     How many developers affected? (1-10)
Impact:    How much does it slow development? (0.25, 0.5, 1, 2, 3)
Confidence: How sure are we? (50%, 80%, 100%)
Effort:    Person-months to fix

RICE Score = (Reach × Impact × Confidence) / Effort

Example:
- Dead code removal: (5 × 0.5 × 1.0) / 0.5 = 5
- Checkout refactor: (8 × 3 × 0.8) / 4 = 4.8
- API cleanup: (6 × 1 × 1.0) / 1 = 6

20% Rule

Allocate 20% of each sprint to debt reduction:
- Sprint velocity: 40 points
- Debt allocation: 8 points per sprint
- Choose highest-impact debt items first

Benefits:
- Steady debt reduction
- No 'big bang' refactors
- Team morale improvement

Decision-Making Framework

When to Address Debt

Address Immediately When:

- Security vulnerability exists
- Data integrity at risk
- Blocking critical feature development
- Causing production incidents
- Compliance/regulatory requirement

Schedule for Next Sprint When:

- Adding 20%+ overhead to current work
- Multiple developers blocked
- Affecting customer experience
- Preventing necessary upgrade

Backlog When:

- Low impact on current work
- No immediate risk
- Nice-to-have improvement
- Future optimization

Never Fix When:

- Working code that's ugly but stable
- Would require rewrite with no benefit
- In code being deprecated
- Cost exceeds lifetime value

Communication Template

Debt: [Brief description]
Impact: [How it affects development]
Risk: [What happens if not fixed]
Effort: [Time to fix]
Recommendation: [When to fix]
Cost of Delay: [$X per day/week]

Tracking Debt in Backlog

Label: technical-debt
Priority: P0-P3 (based on scoring)
Estimate: Story points
Acceptance Criteria:
- [ ] Debt identified and documented
- [ ] Root cause analyzed
- [ ] Solution designed
- [ ] Implementation completed
- [ ] Tests added
- [ ] Metrics verified

Practice Problems

0 / 2 solved
Debt Prioritization Exercise

Given 5 technical debt items in a Magento codebase, prioritize them using the RICE framework and justify the order.

Debt Quadrant Analysis

Classify 8 technical debt examples into the four debt quadrants and recommend actions for each.

Quiz

1. In the debt quadrants, 'Ship now and deal with consequences' falls into which category?

Question 1 options

2. What does the 'interest' metaphor represent in technical debt?

Question 2 options

3. In the 20% rule, what is allocated to debt reduction?

Question 3 options

4. When should technical debt be addressed immediately?

Question 4 options

Flashcards

Question

What are the 4 debt quadrants?

Answer

Deliberate+Reckless, Deliberate+Prudent, Inadvertent+Reckless, Inadvertent+Prudent

Question

What is the 'interest' in technical debt?

Answer

The ongoing cost of not addressing the debt with each future change

Question

What is RICE scoring?

Answer

Reach × Impact × Confidence / Effort - used to prioritize debt items

Question

What is the 20% rule?

Answer

Allocate 20% of each sprint capacity to debt reduction

Question

When to never fix debt?

Answer

When working but ugly, would require rewrite with no benefit, or cost exceeds lifetime value

Revision Notes

Key Takeaways

  • 1. Technical debt has principal (fix cost) and interest (ongoing cost)
  • 2. The 4 quadrants: Deliberate/Inadvertent × Reckless/Prudent guide decision-making
  • 3. Use RICE or cost-of-delay frameworks to objectively prioritize debt
  • 4. The 20% rule ensures steady debt reduction without disrupting feature work
  • 5. Not all debt should be fixed - some is acceptable if cost exceeds value
  • 6. Communicate debt impact in business terms (cost of delay, developer hours)

Interview Tips

  • Explain the technical debt quadrants with real examples
  • How do you decide which debt to fix first?
  • Describe how you would build a business case for addressing debt
  • When is technical debt acceptable?
  • How do you track and report on debt reduction progress?

Cheat Sheet

Prioritizing Technical Debt Cheat Sheet

Quadrants:

  • Deliberate + Reckless: Avoid
  • Deliberate + Prudent: Track & schedule
  • Inadvertent + Reckless: Learn & prevent
  • Inadvertent + Prudent: Document & refactor

Frameworks:

  • RICE: (Reach × Impact × Confidence) / Effort
  • Cost of Delay: daily cost vs fix cost
  • 20% Rule: 8 points per 40-point sprint

Decisions:

  • Security/data risk → Fix now
  • 20%+ overhead → Next sprint
  • Low impact → Backlog
  • Working but ugly → Maybe never