Useful design patterns for unit testing/TDD?

后端 未结 9 653
一个人的身影
一个人的身影 2021-01-29 17:54

Reading this question has helped me solidify some of the problems I\'ve always had with unit-testing, TDD, et al.

Since coming across the TDD approach to development I k

9条回答
  •  无人及你
    2021-01-29 18:55

    Design patterns aren't directly relevant to TDD, as they are implementation details. You shouldn't try to fit patterns into your code just because they exist, but rather they tend to appear as your code evolves. They also become useful if your code is smelly, since they help resolve such issues. Don't develop code with design patterns in mind, just write code. Then get tests passing, and refactor.

提交回复
热议问题