개발방법론/모델링/Refactoring

Parameterize Method <IMG SRC = "http://www.refactoring.com/catalog/updated.gif" border=0>

아름프로 2003. 8. 2. 14:13

Parameterize Method


Several methods do similar things but with different values contained in the method body.

Create one method that uses a parameter for the different values.



Corrections


Clarifying the Mechanics


I've since (after a suggestion from Prof Kahlbrandt) found better mechanics for this refactoring (changes are in bold)

  • Create a parameterized method that can be substituted for each repetitive method

  • Compile

  • Replace the body of one method with a call to the new method

  • Compile and Test

  • Use Inline Method on the old method

  • Repeat for all the methods.


  • Contributors


    • Bernd Kahlbrandt

    For more information see page 283 of Refactoring




    ***** 아름다운프로님에 의해서 게시물 복사 + 카테고리변경되었습니다 (2003-12-18 17:27)