diff.expert
TechniquesExercisesReference
© 2026 diff.expertAn Arbiter course
Home/Reference

Decomposition Reference

Which technique should I reach for? Use this decision tree and cheat sheet to quickly find the right approach for your situation.

Decision Tree

Click the type of change you're making to see technique recommendations.

Question 1

What kind of change are you making?

2Adding a new feature

What's the situation?

→

The code isn't structured to receive it cleanly

Preparatory Refactoring →Scaffold First →
→

It's user-facing and needs gradual rollout

Feature Flags →
→

It requires lots of boilerplate + infrastructure

Scaffold First →
→

Tests don't adequately cover the area

Test-First Decompositionsoonthen add the feature
3Modifying existing behavior

What's the situation?

→

The code is tangled in a large file

Extract and Delegate →
→

A hard-coded value needs to change

Configuration-Driven Behaviorsoon
→

Test coverage is insufficient

Test-First Decompositionsoon
4Replacing an implementation

What's the situation?

→

Swapping one component for another (same interface)

Branch by Abstractionsoon
→

Need high confidence the new version is correct

Parallel Implementationsoon(Dark Launch)
→

Migrating an entire subsystem piece by piece

Strangler Figsoon
5Changing a shared interface or API

What's the situation?

→

Multiple consumers need updating

Expand/Contract →
→

The function signature needs evolution

Interface Segregationsoon
6Modifying database schema

What's the situation?

→

Always — schema changes and code changes are separate PRs

Data Migration Decouplingsoon

Quick Reference

All 12 techniques at a glance. Blue links have full worked examples.

TechniqueOne-LinerBest For
Preparatory RefactoringMake the change easy, then make the easy changeCode needs restructuring before a feature
Feature FlagsShip the code dark, turn it on laterGradual rollout of user-facing features
Branch by AbstractionsoonIntroduce an interface, then swap behind itReplacing implementations incrementally
Strangler FigsoonGrow the new around the oldLarge system migrations
Scaffold FirstShip the structure before the logicNew features with lots of boilerplate
Parallel ImplementationsoonRun new alongside old, compare, switchCritical algorithms needing high confidence
Expand/ContractAdd the new, migrate consumers, remove the oldChanging shared interfaces
Data Migration DecouplingsoonSchema and code are always separate PRsAny database schema change
Test-First DecompositionsoonShip the safety net before the changeModifying untested behavior
Extract and DelegateMove it first, change it secondModifying tangled code
Configuration-Driven BehaviorsoonMake it configurable first, configure secondChanging business rules/thresholds
Interface SegregationsoonNew contract alongside old, migrate, retire oldEvolving function signatures

Common Combinations

Techniques are often chained together. These are battle-tested sequences for common scenarios.

“New backend service”

Scaffold First →→Branch by Abstractionsoon→Feature Flags →→Parallel Implementationsoon

“API evolution”

Expand/Contract →→Interface Segregationsoon

“Schema + feature”

Data Migration Decouplingsoon→Feature Flags →→Scaffold First →

“Code cleanup”

Test-First Decompositionsoon→Extract and Delegate →→Preparatory Refactoring →

5 of 12 techniques fully documented — more coming soon. Browse all techniques →