开发者

How long does it take to become easier with TDD? [closed]

Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 11 years ago.

Improve this question

I believe TDD is one of the most promising dev. practic开发者_运维知识库e but is easily dropped one from dev's tool set.

It is very hard to me now. But many devs. seem to use it seriously in their daily works.

Whenever I tried TDD in mind of all encouragements, benefits and good advices,

but I return to my native programming habits after spending several hours

to run somewhat simple test cases.

Some guys said it took a time to get used with it cause it is practice!.

I just want to know how long does it take to be TDD expert

if you are a dev who cannot live without it.


I started using TDD in 2007 when at work I got a suitable assignment to write a little non-critical utility program (30-40 hours effort). Back then for me it took a couple of hours to figure out what test to write first, and a couple days to twist my head around to thinking about the test first. After about one week I had finished that program and measured in lines of code (not a good measure, I know) my productivity was about the same as in earlier projects (~20 LOC completed production code per hour).

After that first project I was aware that my tests were not yet very good and I was still looking for my style. I was especially focusing on how to name my tests. It took about one year and seven small projects until I was happy with the quality of tests I wrote. At around that time I could say that I had internalized TDD, so then I wrote a TDD tutorial to teach it also others. Of course even after that I've been constantly improving and learning new approaches.


This is hard to answer because test driven development ease of use is far different depending on the environment you are in. If you have old C code with lots of hard dependencies (where the dependencies are concrete classes, not interfaces) then unit testing becomes much more difficult.

If you are using something like Spring with dependency injection, it becomes much much easier to mockup an object and inject into the class you are testing. Same goes for something like Ruby or Groovy/Grails where you can essentially mixin or change the functionality of the underlying class.

I would first get my feet wet in something like Grails or Rails which were built with TDD in mind and have things for making TDD much easier to jump into.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜