I'm starting to learn about Test Driven Development. I've read quite a few articles that talk about TDD. Some refer to it as Test Driven Development. Ot开发者_如何学编程hers call it Test Driven Design. Are they the same thing? I get the impression they are the same, but if not, what are the main differences?
Test driven development refers to a practice describing how to write code.
Test driven design makes an additional claim: that following this practice will result in good (overall) design.
There are some of the TDD evangelists adocating that "Test Driven Development" is primarily a design technique, so they renamed it "Test Driven Design" some time ago. But this point of view has been seen very sceptical by others, read for example this former SO post
Does Test Driven Development take the focus from Design?
There is also an interesting german blog entry of Ralf Westphal discussing this topic:
http://ralfw.blogspot.com/2011/07/test-driven-unterstanding.html
(Here's a Google Translation if you don't understand German).
Test driven development is developing tests before writing what will be the production code. The goal behind this is to produce what are called "executable requirements" and it is all about writing just enough code to satisfy requirements.
If you use a Mocking framework like Moq you will be forced to construct your code based on Inversion of Control principles, using Dependency Injection, which is considered good practice as it reduces the "brittleness" of your code and promotes loose coupling at a fine grained aspect of your solution.
So to answer your question TDDevelopment is more about implementing requirements in code, using whatever tools you wish. TDDesign is the next step in the evolution of unit testing where you force good design by adopting Mocking frameworks such as Moq. Code that is produced with TDDesign is guaranteed to conform to the requirements of an IoC container such as spring.
TDDev is good ... TDDesign is better.
精彩评论