[TIP] testing: why bother?
C. Titus Brown
ctb at msu.edu
Wed Mar 23 08:37:24 PDT 2011
On Wed, Mar 23, 2011 at 02:22:06PM +0000, Jonathan Lange wrote:
> On Wed, Mar 23, 2011 at 2:09 PM, C. Titus Brown <ctb at msu.edu> wrote:
> > (Since I like to argue with Michael...)
> > IMO, TDD is too big a leap for people without a fair amount of
> > programming experience. ?However, once you have a bit of testing
> > under your belt, TDD becomes much easier to justify.
> What makes you say that, other than an entirely understandable desire
> to argue with Michael?
I'll just whip out the "I teach undergrads for (part of) a living" card here...
It may be that we get our students off to a bad start somehow, but my
experience with our 2nd and 3rd year students is that they are so
immature as programmers that they often don't get what to test for,
they have no idea what a "specification" is, and, as a result, their
tests are not clear expressions of anything.
Or, to put it another way, learning how to test is just as hard as learning
how to program. Since we don't know how to teach the latter, it's not
clear to me why we would know how to teach the former :)
Also I don't know of any actual evidence that TDD or agile actually improves
programming speed, ability, thought, or anything else, over other methods of
specification (more formal ones, for example). Anecdotes need not apply.
> I have actually been thinking recently that if I were to have the
> opportunity to teach programming to a beginner then I would like to
> try starting with TDD (& probably also VCS) from the very beginning. I
> have recently watched a couple of novice programmers suffer through
> their formal instruction, largely because they were always piling
> uncertainty upon uncertainty. When doing assignments, they would add
> some code that they thought worked, then some more code that they
> thought worked, then some more, and then after a few hours of
> difficult thinking and coding they would try to run the code and then
> see that it doesn't work and then be very upset.
> My hypotheses are that if they were taught to do TDD, this would be
> much less of a problem, and that the relatively rigid discipline of
> TDD makes it teachable even to programming novices.
> I guess this is wandering rather far off topic, but I would be very
> interested to hear from anyone who has tried this.
I'm not a big fan of TDD so I may not be doing this with conviction, but
I have at least tried a little bit ;).
Lest anyone think I'm negative on the whole concept, I'm not! I am just
confused about how to do a good job of inculcating testing; coming from my
background, I thought it would be easier to put into effect, but it hasn't
been so far. I'd love to figure out how to do it. And how to measure the
effect so that I can prove I've done it.
C. Titus Brown, ctb at msu.edu
More information about the testing-in-python