Notes on 'Refactoring' - 5.1 Seperate Query from Modifier
Notes on Refactoring -- 5.1 Seperate Query from ModifierBefore RefactoringgetPersonAndIncreaseCou
Notes on 'Refactoring' -- 5.1 Seperate Query from Modifier
Before Refactoring
getPersonAndIncreaseCounter(){ counter ++; return person; }
After Refactoring getPerson(){ return person; } increaseCounter{ counter ++; }
Benefits You can call getPerson() as often as you like. You have a lot less to worry about.
Exception It's OK to change personCache in getPerson() method.