2011-04-05 4 views
0

응용 프로그램을 디자인 할 때 내 사이트에서 내 모델 함수와 어떻게 상호 작용하고 싶은지 생각하는 것이 가장 쉽습니다. 내가 디자인에가는 경우이 코딩 스타일은 무엇입니까?

그래서 예를에 대한 포럼 시스템 내가 먼저 내가 바로 메모장이 입력을 시작, 용어 사용을 정의하기 시작할 것입니다 :

/* 
    - Thread 
     This is a thread a user has created in a board. 

    - Board 
     This is a unique place for threads to be stored. 

    - Categories 
     This is a way to create sub-menu boards. Boards within boards. 

    - Comment 
     This is a reply/comment to a thread. 
*/ 

    // ------------------------------------- 
    // THREAD FUNCTIONS 
    // ------------------------------------- 

    // Add comment to a thread 
    $thread->user_id = '55'; 
    $thread->thread_id = '66'; 
    $thread->add_comment(array('comment' => 'blah')); 

    // Edit comment (basically the same structure as add_comment) 
    $thread->user_id = '55'; 
    $thread->thread_id = '66'; 
    $thread->edit_comment(array('comment' => 'blah2')); 

    // Delete comment: 
    $thread->comment_id = '55'; 
    $thread->delete_comment(); 

    // Get's all the comment details within a thread. 
    $comments = $thread->get('username, comment, date_added, date_edited, subject'); 
    $user_details = $user->user_id('5') 
         ->get('user_title, user_joined_date, 
           user_location, post_count'); 

무엇 이런 종류의 접근 방식이 무엇입니까? 나는 정상인가? ;-D

+0

당신은 아마 보통이고 이것은 디자인 과정, 프로토 타이핑, 가짜 코딩이라고합니다! – markus

+0

물론 그 모든 것들입니다. 그러나이 디자인 패턴에 어떤 이름이 있습니까? 즉, 위로 아래로, 위로 아래로, 나선형으로 등입니까? –

+0

이것은 디자인 패턴이 아닙니다. 사고 설계에 대한 귀하의 개인적인 접근 방법 일뿐입니다. – markus

답변

3

시험은 테스트없이 테스트 주도 개발과 비슷합니다. TDD에서는 먼저 API를 디자인하고 테스트를 작성합니다. 코드를 먼저 구현하지 않으면 서 디자인 작업을 진행하고있는 것입니다. 그러나 TDD의 빅 프로는 코드가 실제로 작성된 후에 유효성을 검사해야하는 테스트 케이스를 작성해야합니다.

관련 문제