본문 바로가기

KnowledgeBase

Clean Code

3. 함수

함수의 목적 or 종류
    행위 : man.setName("Tom")
    변환 : age = man.getAge()
    상태 : if(man.isGirl())

함수의 추상화 레벨 
    함수 내부의 추상화 레벨을 일치시킬것.

public void CreateTestPage()
{
    IncludeSetups();
    IncludeTestPageContent();
    IncludeTeardowns();
}

public void IncludeSetups()
{
    if(this.IsSuite())
    {
        IncludeSuiteSetup();
    }

    IncludeRegularSetup();
}

public void IncludeSuiteSetup()
{
    var parentPage = FindParentSuitePage();

    // add include statement with the path of the parentPage
}
To include the setups and teardowns, we include setups, then we include the test page content, and then we include the teardowns.
    To include the setups, we include the suite setup if this is a suite, then we include the regular setup.
        To include the suite setup, we search the parent hierarchy for the "SuiteSetUp" page and add an include statement with the path of that page.
            To search the parent ...