19 Replies - 4590 Views - Last Post: 07 March 2013 - 07:20 AM
#1
Test Driven Development, do you use it?
Posted 12 February 2013 - 05:17 PM
Replies To: Test Driven Development, do you use it?
#2
Re: Test Driven Development, do you use it?
Posted 12 February 2013 - 07:11 PM
#3
Re: Test Driven Development, do you use it?
Posted 12 February 2013 - 07:19 PM
It's quite a struggle to try and flip your mindset to test-driven when you're not used to it, but I can certainly see the benefits. Knowing what you have to satisfy, test-wise, is definitely a good way to approach a development problem. I'm definitely going to try and use it going forward.
This post has been edited by runfaster: 12 February 2013 - 07:21 PM
#4
Re: Test Driven Development, do you use it?
Posted 12 February 2013 - 07:31 PM
Thanks!
#5
Re: Test Driven Development, do you use it?
Posted 12 February 2013 - 07:46 PM
#6
Re: Test Driven Development, do you use it?
Posted 12 February 2013 - 07:55 PM
Another effect of TDD is that it cuts down on analysis paralysis and feature creep. If I am holding true to TDD principles, I should be writing the minimum amount of code to make tests pass. I shouldn't be designing for far off what-ifs. I should be writing tests that mimic how the code will be used now. This accelerates development.
If ever I get to that point where I need to support one of those what-if features, then I write a new test to test the new feature and work to make that new feature test succeed while keeping the already existing tests working. This accelerates development as well because I have assurance that I am not creating regressions when I add the new feature.
#7
Re: Test Driven Development, do you use it?
Posted 12 February 2013 - 07:56 PM
#8
Re: Test Driven Development, do you use it?
Posted 12 February 2013 - 09:04 PM
One thing I've noticed as I use more python, though, is sort of the opposite of Skydiver's experience: writing shorter functions with looser couplings generally means that I'm a lot less concerned about bugs, because there is almost no place for them to hide. So I certainly could do more testing, and it would be easier under this model, but at the same time it seems a lot less pointful because a five-line function with no external dependencies is pretty easy to test "by eye".*
Again, I don't say this is good practice, and certainly it doesn't scale well, but it's where I'm at right now. For larger projects, the likely point of failure will likely be in the function calls, not the functions' functionality.
The thing I lose by this, of course, is the watchdog effect, which seems to me the most important argument for TDD. I can break my programs by changing them, and TDD would at least give me confidence that I hadn't broken anything I'd tested for.
* Aside: One way to justify small, loose functions is as a tricky way around Dijkstra's observation that no non-trivial program can be proved error-free. Small, self-contained functions are in fact trivial programs and can be proved correct. This does not prove the program as a whole but it gives us a basis for improved confidence.
EDIT: BTW, if there is any sort of recording of your talk, I hope you'll post a link to it. I'd like to see what you have to say on the subject.
This post has been edited by jon.kiparsky: 12 February 2013 - 09:06 PM
#9
Re: Test Driven Development, do you use it?
Posted 13 February 2013 - 10:48 AM
As others have said, it would be interesting to see any notes/video that comes from this talk.
#10
Re: Test Driven Development, do you use it?
Posted 13 February 2013 - 11:10 AM
Afterwards I just do the tests again. The difference I do from TDD is that I don't do anything formally. I figure if I can get to the point of truly understanding the problem then all the overhead of testing in a TDD manner is really wasted time.
I think in some ways TDD is again treating symptoms and not really the problem. If you understand the problem, most of the time the programmer knows exactly what they must do to correct the problem.
As for additional features, well I can see TDD being a bit more productive. But then again I am usually on the thought that if you design the system well to start any additional feature should be easy to implement and highly decoupled.
Just some thoughts. They may be the right or wrong way to go, but it has worked out for me.
This post has been edited by Martyr2: 13 February 2013 - 11:11 AM
#11
Re: Test Driven Development, do you use it?
Posted 13 February 2013 - 11:48 AM
Quote
I don't see that there's anything gained by thinking of it as "right way" and "wrong way". Rather, it's "does this make me more effective, and is it worth the tradeoffs?". It seems to me that you're pretty effective - just from reading your posts - so maybe you're okay with what you're doing now. Moving to TDD requires a lot of effort, you have to re-configure the way you work, so there's a short-term trade-off (you're less effective while you're learning to be a TDD developer) and there's a risk it might not add a lot to your effectiveness, so maybe it doesn't pencil out for you. That's cool - it's just one more tool in the bag.
Quote
The thing that you're leaving out here is the "watchdog" property: Under TDD, your tests are persistent, and they catch future errors and not just past ones. As I say, I'm more in line with your way of working, but if there's one feature that seems like a real silver bullet, that's it.
Good design reduces complexity, and that's a good thing and it makes development easier, so the same developer working on a good design can manage a program that is more complex by some large factor. (however you measure these things) However, what this really buys you is the ability to work on larger programs in about the same way you worked on smaller programs pre-TDD.
The implicit promise of TDD is a qualitative difference: now you have a guarantee that certain mistakes will warn you when you make them. When I do work in test-driven mode, this completely changes my approach to the work. In a way, it's like moving from saving to the filesystem to version control - everything changes.
So why don't I do it? Mostly because it's not a habit, I guess. It takes a certain amount of self discipline to think all the way through a problem and then hold off solving it while you write tests. That's hard for me to do, honestly.
This post has been edited by jon.kiparsky: 13 February 2013 - 11:53 AM
#12
Re: Test Driven Development, do you use it?
Posted 13 February 2013 - 12:07 PM
Not all the code I write can benefit from the expense it takes to do this. That or the code is so routine that I have no need to test it in such a granular way. I can just jam it out and throw it at QA.
I do sometimes get the job of writing new technologies for the office. Not often as our main objective currently isn't new technologies, but instead bringing our aging technologies into the modern market.
But when I get to write new technologies, I benefit greatly from TDD. I may not follow an orthodox form of it, but it's still test driven.
#13
Re: Test Driven Development, do you use it?
Posted 13 February 2013 - 02:57 PM
#14
Re: Test Driven Development, do you use it?
Posted 13 February 2013 - 05:27 PM
Watching some dev videos recently I would be more inclined to use unit tests, when writing these tests what you write often becomes part of the classes you use in the final code so you don't feel you are wasting time.
Where any kind of tests really help is when many people are all on a single project and pushing new features out often, it becomes hard to ensure you don't break parts of a system you have not worked on.
So I do use it sometimes and have mixed feelings about it.
#15
Re: Test Driven Development, do you use it?
Posted 24 February 2013 - 06:07 PM
|
|

New Topic/Question
Reply



MultiQuote











|