Does TDD mean not thinking about class design?

前端 未结 8 1852
生来不讨喜
生来不讨喜 2021-02-06 01:17

I am making a role playing game for fun and attempting to use TDD while developing it. Many of the TDD examples I see focus on creating the test first, then creating objects tha

8条回答
  •  失恋的感觉
    2021-02-06 02:02

    I think the balanced approach is the one you need to take. First model the classes of your domain, because without them, how do you even know what to test?

    Then, you'll probably create stubs or shells of these classes, with mostly empty implementations, just to let you write some test structures.

    Once that's done, your test cases will likely illuminate the need for new methods / classes / properties that weren't in the original design, but are discovered as being necessary.

提交回复
热议问题