Changes between Version 1 and Version 2 of リファクタリングガイドライン
- Timestamp:
- 2011/01/28 10:34:20 (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
リファクタリングガイドライン
v1 v2 4 4 5 5 == init 関数 == 6 7 変数の初期化のみを行い, ビジネスロジックは記述しないこと 6 init 関数は, クラスの初期化を目的とします. 7 ビジネスロジックの記述をしてはいけません. 8 8 9 9 {{{ … … 11 11 <?php 12 12 function init() { 13 // 変数の初期化は OK 14 $this->tpl_mainpage = 'index.tpl'; 15 $this->arrDISP = $masterData->getMasterData("mtb_disp"); 16 17 // ビジネスロジックの記述は NG 18 if (count($this->arrPayment) > 0) { 19 $i = 0; 20 foreach ($this->arrPayment as $val) { 21 $this->payment[$i] = $val; 22 $i++; 23 } 24 } 25 } 26 ?> 27 }}} 13 14 /** 15 * NG ビジネスロジックの記述はしない 16 */ 17 if (count($this->arrPayment) > 0) { 18 $i = 0; 19 foreach ($this->arrPayment as $val) { 20 $this->payment[$i] = $val; 21 $i++; 22 } 23 } 24 25 /** 26 * OK クラスの初期化のみ行う 27 */ 28 $this->tpl_mainpage = 'index.tpl'; 29 $this->arrDISP = $masterData->getMasterData("mtb_disp"); 30 } 31 }}} 32 28 33 == action 関数 == 29 34 … … 203 208 204 209 {{{ 205 誤) 206 $arrRet 207 208 正) 209 $arrProducts 210 #!php 211 <?php 212 213 /** 違反サンプル */ 214 $arrRet = getProducts(); 215 216 /** 修正サンプル */ 217 $arrProducts = getProducts(); 210 218 }}} 211 219