🌱 Refactor vs Patch

A principle born from tangled CSS and creative iteration
Core Principle: When requirements evolve, replace the old solution instead of layering fixes on top. Refactor the foundation rather than patch the symptoms.

🔍 The Discovery

This principle emerged during a conversation about CSS spacing issues. What started as a request for "breathing room" evolved into "compact cards," then "minimal padding," then "no bottom boundary." Each iteration, instead of replacing the previous solution, I kept adding new rules on top of old ones.

The result: CSS rules fighting each other, duplicate definitions, and a simple layout problem becoming impossibly complex.

💡 The Insight: The problem wasn't the evolving requirements—that's natural creative iteration. The problem was my approach of patching instead of refactoring.

⚔️ Patch vs Refactor

❌ Patching Approach
  • Add new rules alongside old ones
  • Override with !important
  • Layer fixes on top of problems
  • Accumulate technical debt
  • Create conflicting definitions
  • Make future changes harder
✅ Refactoring Approach
  • Replace old rules with new ones
  • Consolidate related definitions
  • Clean up as you go
  • Maintain consistent architecture
  • Single source of truth
  • Enable future flexibility

💻 Code Example

The Patching Trap:

/* Original requirement: "breathing room" */ .file-card { padding: 30px; margin-bottom: 20px; } /* Client: "make it more compact" */ .file-card { padding: 30px; /* Still here! */ margin-bottom: 20px; min-height: 70px; /* Added on top */ } /* Client: "reduce vertical padding to 2px" */ .file-card { padding: 30px; /* Still here! */ margin-bottom: 20px; min-height: 70px; padding-top: 2px; /* Conflicts! */ padding-bottom: 2px; } /* Result: Chaos and conflicts */

The Refactoring Solution:

/* Each iteration replaces the previous */ /* Version 1: Breathing room */ .file-card { padding: 30px; margin-bottom: 20px; } /* Version 2: More compact (REPLACE, don't add) */ .file-card { padding: 15px; margin-bottom: 10px; min-height: 70px; } /* Version 3: Minimal padding (REPLACE again) */ .file-card { padding: 8px; margin-bottom: 5px; min-height: 60px; } /* Result: Clean, consistent, understandable */

🌿 Beyond Code: Life Metaphors

🏡 The House Renovation:
Patching: When the kitchen feels cramped, add an extension. When that feels wrong, add another room. Soon you have a maze of additions.
Refactoring: When the kitchen feels cramped, redesign the entire floor plan to better use the space.
🌱 The Garden Growth:
Patching: When plants outgrow their spots, squeeze new ones in between. Keep adding until it's overcrowded.
Refactoring: When plants outgrow their spots, replant the entire section with proper spacing for current needs.
📝 The Essay Evolution:
Patching: When your argument changes, add footnotes and parenthetical corrections throughout.
Refactoring: When your argument changes, rewrite the paragraphs to coherently express the new thinking.

🎯 When to Apply This Principle

Refactor when:

  • Requirements have fundamentally shifted
  • You're adding your third "override" or "exception"
  • The solution feels unnecessarily complex
  • You're working around your own previous decisions
  • Future changes will be harder because of current patches

Patch when:

  • It's a genuine edge case or temporary fix
  • The underlying architecture is still sound
  • You're under extreme time pressure (but plan to refactor later)
  • The change is truly additive, not corrective

🌊 The Creative Process Parallel

In creative work, requirements naturally evolve. A client saying "more breathing room" then "but compact" isn't contradictory—it's iteration toward the right solution. The problem isn't the evolution; it's how we handle it.

🎨 Creative Refactoring: Each iteration should build on lessons learned, not pile on top of previous attempts. Good creative process involves stepping back and reimagining, not just adding layers.

Whether it's code, design, writing, or thinking—the principle holds: when the foundation shifts, rebuild it rather than propping it up.

🔧 Practical Implementation

Code Refactoring Checklist:

  • Before adding a new rule, check if it conflicts with existing ones
  • If you're overriding more than one property, consider replacing the entire rule
  • Consolidate related properties into single, coherent definitions
  • Remove unused or superseded rules completely
  • Test that the refactored version achieves the same goals more cleanly

Life Refactoring Signals:

  • You're making exceptions to your exceptions
  • Simple tasks feel unnecessarily complicated
  • You're working around systems you created
  • New goals conflict with old structures
  • You find yourself saying "it's complicated" a lot
Remember: Complexity is often accumulated accidentally through well-intentioned patches. Simplicity is achieved intentionally through thoughtful refactoring.