Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

test driven design

 
kundan varma
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
What is test driven design??? How can i make any project based on this design?
Thanks,
kundan
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a good summary at http://www.objectmentor.com/writeUps/TestDrivenDevelopment and an example at http://www.objectmentor.com/resources/articles/xpepisode.htm
 
kundan varma
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you really think XP programming should be so strictly followed or is possible in real life coding and design???
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's at least a good idea to try it for a while, in my experience.

I don't understand what you mean by "real life coding and design" - what in the example seems to conflict with reality to you?
 
kundan varma
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What i mean was that is an example rather than real life project
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, they work in real life. Robert Martin proposes these three rules:


Over the years I have come to describe Test Driven Development in terms of three simple rules. They are:

1. You are not allowed to write any production code unless it is to make a failing unit test pass.

2. You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures.

3. You are not allowed to write any more production code than is sufficient to pass the one failing unit test.

See more from his blog on the topic.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by kundan varma:
What i mean was that is an example rather than real life project


Well, when I work in real life, it often enough works very similarly to the example, yes.

I guess I still don't understand what your doubt is...
 
Jeff Langr
author
Ranch Hand
Posts: 799
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ahhh, I'm still proud of that Object Mentor writeup on TDD for its short and succinct nature. It makes things sound so deceptively easy. ;-)

As far as using TDD (test-driven development) on a "real" effort, shops all over the place are doing it all the time, some for extremely large applications. Sabre, for example, uses it for some pretty complex systems.

Most of us who've done TDD for some time won't go back to any other way of development. None of us would consider writing any sort of large system without the confidence, design guidance, and comprehensive documentation TDD gives you.

-Jeff-
 
Jeff Langr
author
Ranch Hand
Posts: 799
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh yeah, and you can do TDD and pretend that it never came out of XP. It works just fine as a development practice on its own.

-Jeff-
 
Jeff Langr
author
Ranch Hand
Posts: 799
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want an example of a "real" system built using TDD, take a look at the source for the testing tool called Fitnesse.
 
kundan varma
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all for your inputs, ya now its clear to me and acceps that TDD is the right and proper way of doing a project

Thanks,
kundan
 
Michael Duffy
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The never-ending fight that I have with project managers is the time and effort required to develop and maintain a complete JUnit test suite. If you test every class and every method, you've roughly doubled the size of your code base and maintainence effort. That effort isn't free and without cost, and it takes an enlightened PM to realize what's in it for them. When they are rewarded on budget and schedule metrics, and not on-going quality or maintainence, it's a hard sell.

I try explaining that it's better to find defects as early as possible, and a complete JUnit suite will pay dividends later on when it comes time to refactor or add new features, but the argument often falls on deaf ears.

We did write JUnit tests on the last project that went to production - on time and no defects, but we were far from 100% code coverage. As deadlines loomed the JUnit tests were put aside.

I hope to do better next time, but it takes planning and foresight. Not everyone on the team is 100% behind it.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is that without the tests, you don't know as well when the code really is *done" - that is, is actually working.

With other words, when you don't have tests, how can you say you are done when actually you have to expect to still spend a significant amount of time on debugging and bug fixing?
 
Hemant Agarwal
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nice discussion
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic