您是否遇到过TDD增加开发时间的情况? [英] Have you been in cases where TDD increased development time?

查看:64
本文介绍了您是否遇到过TDD增加开发时间的情况?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读 TDD-如何开始真正思考TDD?,并且我注意到许多答案都表明测试+应用程序应该比编写应用程序花费更少的时间.以我的经验,这是不正确的.但我的问题是,我编写的代码中约有90%具有大量的操作系统调用.与最初编写代码相比,实际模拟这些代码花费的时间要长得多.有时编写测试的时间是编写实际代码的4到5倍.

I was reading TDD - How to start really thinking TDD? and I noticed many of the answers indicate that tests + application should take less time than just writing the application. In my experience, this is not true. My problem though is that some 90% of the code I write has a TON of operating system calls. The time spent to actually mock these up takes much longer than just writing the code in the first place. Sometimes 4 or 5 times as long to write the test as to write the actual code.

我很好奇在这种情况下是否还有其他开发人员.

I'm curious if there are other developers in this kind of a scenario.

推荐答案

通常,当人们感到TDD使得完成某项工作花费的时间更长时,这是因为他们对以下内容没有正确的定义: 完成"或工作".通常,这些人相信代码完整"的神话.

In general, when people have the experience that TDD makes the time it takes to get a piece of work done take longer it is because they have an improper definition of "done" or of "piece of work." Typically these people believe in the myth of "code complete."

任何人都可以更快地敲出一些代码,而不是他们敲出一些代码和一些测试.但是,键入并不是时间的真正来源.如果您开始衡量从概念到部署的整个时间(从汤到坚果)的整个功能,那么您将不再拥有TDD的花费更长的时间"的经验.

Anyone can bang out some code faster than they can bang out some code and some tests. However, typing is not really where the time goes. If you start measuring the whole time - from concept to deployment - that a whole feature - from soup to nuts - takes, you will stop having the experience of TDD "taking longer."

此外,正如乔尔(Joel)所暗示的那样,操作系统并不是那么重要:模拟操作系统,以便您可以发短信给您复杂的操作系统调用使用,但不必费心测试操作系统,除非您有理由需要提出一个假设作为检验.

Also, the OS thing isn't that important, as Joel implies: mock out the OS so that you can text your complex uses of the OS calls but don't bother testing the OS unless you have a reason you need to call out an assumption as a test.

这篇关于您是否遇到过TDD增加开发时间的情况?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆