Changes between Version 1 and Version 2 of リファクタリングガイドライン


Ignore:
Timestamp:
2011/01/28 10:34:20 (13 years ago)
Author:
nanasess
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • リファクタリングガイドライン

    v1 v2  
    44 
    55== init 関数 == 
    6  
    7 変数の初期化のみを行い, ビジネスロジックは記述しないこと 
     6init 関数は, クラスの初期化を目的とします. 
     7ビジネスロジックの記述をしてはいけません. 
    88 
    99{{{ 
     
    1111<?php 
    1212function 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 
    2833== action 関数 == 
    2934 
     
    203208 
    204209{{{ 
    205 誤) 
    206 $arrRet 
    207  
    208 正) 
    209 $arrProducts 
     210#!php 
     211<?php 
     212 
     213/** 違反サンプル */ 
     214$arrRet = getProducts(); 
     215 
     216/** 修正サンプル */ 
     217$arrProducts = getProducts(); 
    210218}}} 
    211219