TDD in XCode (Objective-C)
What is TDD?
TDD (Test Driven Develop) 近期因為敏捷式開發火紅也受到相當的重視, TDD 用三條規則就可以說明其實踐和理念。
- You are not allowed to write any production code unless it is to make a failing unit test pass.
- You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures.
- You are not allowed to write any more production code than is sufficient to pass the one failing unit test.
大意就是,寫最基本的測試->通過測試->重構->進行下一個測試,其實我還滿認同 TDD 的理念的,先求穩在求好。 一開始我也覺得如此開發阿很浪費時間,其實自己實際在一些案子上面實踐後,發現其實並不會尤其開發功能越多, 越複雜的反而比較節省時間。
