12
Move Function
Goal
Each function lives where its data lives; coupling between modules drops.
Before the refactoring
class Order { totalPriority() { return this.account.priority(); } }After the refactoringclass Account { priority() { /* ... */ } }
class Order { /* asks account directly when needed */ }Savings
Modules become more cohesive; tests stay focused; feature-envy patterns disappear.
Note
Moving a function across modules can pull dependencies with it — confirm the new home actually has access to everything the function needs.