首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

Notes on 'Refactoring' - 5.1 Seperate Query from Modifier

2012-12-21 
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.

热点排行