Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我越来越喜欢 TDD,在我看来,我所有的课程通常最终都是纯粹的数据持有者或纯粹的数据操纵者。这是TDD的预期结果吗?还是我采取了过于极端的方法?
TDD 确实意味着您将倾向于编写依赖较少的代码。这反过来又意味着类倾向于承担单一责任。正如您所描述的,这可能表现为拥有更简单的类。它不一定必须以这种方式结束,但通过无情地重构你可以解决这个问题。