Does TDD mean not thinking about class design?

前端 未结 8 1827
生来不讨喜
生来不讨喜 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:04

    I think it's generally assumed (even by the TDD purists) that a programmer designing an application by writing tests already knows something about design and architecture. Otherwise you can just paint yourself into programming chaos and anarchy by writing tests to the abandonment of any design principles.

    Consequently, a developer writing an application "tests first" already has a fair idea of what his final class structure will look like, and that vision guides him when he is writing his tests.

提交回复
热议问题