原帖由 newmike 于 2009-7-25 22:42 发表
如果时间充裕,TDD挺好,其实只要真肯花时间多写unit test,就会提高code quality,无论是否用TDD。不过我现在这个project只有1/3的code有unit test,PM只要feature不要unit test,开始还是坚持写unit test,后来没时 ...
原帖由 leiz 于 2009-7-26 14:12 发表
TDD解决2个问题, implementation 和 unit tests. 在你考虑test case之前,应考虑的是你object的 user case, 这些就是你要test的functionality. 在你test每一个functionality的时候才要考虑test case.
原帖由 Null_pointer 于 2009-7-26 15:38 发表
理论是很好的。
实践起来 还是看个人喜好了。
我就会选择在适当的时候test driven
大部分时候一边test 一边写 production code
原帖由 newmike 于 2009-7-26 15:50 发表
同意,用不惯不必勉强。
不太明白你说的‘一边test 一边写 production code’,比如, 你已知道需要有一个class,你是先考虑test case,还是先考虑implementation,至于写coding的顺序又如何?
另,不知大 ...
原帖由 好事之徒 于 2009-7-26 17:26 发表
我的观点可能有点极端 但我认为无论什么process什么methodology 最后的关键还是人 (人月神话里已经总结得很清楚了)Ken Thompson 用他老婆带着小孩外出度假的4个礼拜就写完了第一个UNIX (he didn't need to know an ...
原帖由 Null_pointer 于 2009-7-26 18:09 发表
先考虑test case 那个就是 TDD了
我意思就是 go and see, implement 的时候想到 这个情况 就写test case。
还有我们公司是单独的testing department, script functional testing. Developer只是unit test
原帖由 newmike 于 2009-7-26 18:11 发表
同意人是软件开发最关键的观点。但是人月也不是说process/methodology没用,而是批评当时的流行观点 - 片面强调工程学,忽视人件。那是因为当时人们不太了解软件工程和普通工程的区别。而今天的优秀开发人员也是 ...
原帖由 newmike 于 2009-7-26 17:51 发表
BDD - 你是指Behavior Driven Dev? 它和TDD着重点又很不同了。不知你们的user story是谁写的,如果是你们的BA,恕我直言,不过是新瓶装旧酒,关键只是一个装字。如果是你们的客户写的,我倒是愿闻其详。
原帖由 rsystem 于 2009-7-26 19:33 发表
我们的user story是plain english, 所以是人就能看得懂, 但是plain english也可以运行, 看有没有failure
原帖由 好事之徒 于 2009-7-26 19:31 发表
software development 还不是engineering, 跟其他工程领域相比,我们其实对怎样做software还不是很有idea, 我们只是以为我们知道。
http://www.codinghorror.com/blog/archives/001288.html
原帖由 newmike 于 2009-7-26 15:31 发表
4) 但是TDD建议的考虑顺序是不同的:" i9 M; ?4 G% s& P
i. what need to do (functionality)
ii. how to ensure the implementation is correct (test case): l$ ~- w* {5 m+ E" ~: Z Y. t( O
iii. how to implement it (implementation)- L( W }) A7 M- x
原帖由 好事之徒 于 2009-7-26 17:26 发表
我的观点可能有点极端 但我认为无论什么process什么methodology 最后的关键还是人 (人月神话里已经总结得很清楚了)Ken Thompson 用他老婆带着小孩外出度假的4个礼拜就写完了第一个UNIX (he didn't need to know an ...
原帖由 newmike 于 2009-7-25 22:42 发表
如果时间充裕,TDD挺好,其实只要真肯花时间多写unit test,就会提高code quality,无论是否用TDD。不过我现在这个project只有1/3的code有unit test,PM只要feature不要unit test,开始还是坚持写unit test,后来没时 ...
原帖由 newmike 于 2009-7-25 23:02 发表
修bug本身倒是不可怕,如果code本身结构合理,即使是没有unit test,也不难refactoring。但是结构混乱的code,即使有unit test也还是big messy。至于没test且混乱的code,那就是噩梦。
我的看法是process和 ...
原帖由 newmike 于 2009-7-26 15:31 发表
看来大家对TDD的理解是挺不同的。
我的理解:
1)TDD是process,一种agile风格的,由xp一些practices延伸来的process。而unit test,则是独立于TDD的best practice。不用TDD,照样可以用unit test,然而,没有 ...
原帖由 好事之徒 于 2009-7-26 17:26 发表
我的观点可能有点极端 但我认为无论什么process什么methodology 最后的关键还是人 (人月神话里已经总结得很清楚了)Ken Thompson 用他老婆带着小孩外出度假的4个礼拜就写完了第一个UNIX (he didn't need to know an ...
原帖由 leiz 于 2009-7-26 20:51 发表
LZ 看上去对TDD比较了解了,我想添加一点的是,在performance很重要的application, eg. real time application,很多unit test上的实现是很困难的,不是不可能,但是添加了unit test实现上的困难性,从而让整个TDD过程很cu ...
原帖由 ybbest 于 2009-7-26 21:00 发表
Yes , you need to design your code so that you can test it .I suggest you to read google testing blogs.They got some genius there to talk about how to do it properly.
原帖由 newmike 于 2009-7-26 22:06 发表
LZ, very glad to hear your voice. I agree with most of your point, except the following stuff:
> PM is not an excuse... However, it is your responsibility to convince your pm...
Not agree with t ...
原帖由 leiz 于 2009-7-26 20:03 发表
我想说的是,第2步,并不光是注重test本身,从test的角度发现object的user case,从而更好的设计你的code.而test case只是用来保证正确性的.
比方说,你的object是一个简单的calculator,你在想test的时候,先要想得是 ...
原帖由 newmike 于 2009-7-26 22:31 发表
同意。我关心的正是这么做的好处和局限。先写test case还是先写implementation,即使不那么重要,方便就成。TDD本质上提倡一种新的设计思路,用testing的角度来驱动设计。我的应用体会是没有发现特别的好处和局限 ...
原帖由 ybbest 于 2009-7-26 22:17 发表
Different companies got different approaches.In my companies we have practice lead to defend ourselves from those pm's shit(like do not write unit tests because of budget).Our practice lead will s ...
原帖由 ybbest 于 2009-7-26 22:39 发表
No,no,no.
As I said before you can not write your tests if you do not have any clear requirements or you do not fully understand the requirements.
When you write implementation,it is called an s ...
看来大家对TDD的理解是挺不同的。
我的理解:
......
3)我猜你要表达的其实和我前面说的一致,考虑顺序都是:
i. what need to do (functionality)
ii. how to implement it (implementation)
iii. how to ensure the implementation is correct (test case)
4) 但是TDD建议的考虑顺序是不同的:
i. what need to do (functionality)
ii. how to ensure the implementation is correct (test case)
iii. how to implement it (implementation)
实际中,我不习惯这种顺序,还是惯用3)的顺序思考。
.......
原帖由 ybbest 于 2009-7-26 23:06 发表
I can understand where you are coming from.At the beginning I force myself to write test before implementation.(why? as I said before).I see the benefits and I keep doing this way.Refer to the step 4 ...
原帖由 ybbest 于 2009-7-26 23:38 发表
Real benefits are that you are using code to document code in terms of tests and you make sure you understand what is required before writing code.If you do not see these as benefits then I can not c ...
欢迎光临 新西兰天维网社区 (http://bbs.skykiwi.com/) | Powered by Discuz! X2 |