David A. Black said... > On Sun, 3 Aug 2008, James Britt wrote: > > David A. Black wrote: > >> In fact, one question that has come to intrigue me recently is the > >> question of whether there are any active programmers who have > >> literally written code test-first from the time they first learned how > >> to program onward. I suspect the answer is no -- and if that's the > >> case, it means that there is no evidence for the position that it's > >> always, automatically bad to write code without a test. > > > > > > Has anyone ever seen a Learn To Program or Learn Language Blub book that did > > TDD? I doubt such a thing exists. Instead, people are shown code, > > encouraged to write code, then (in so many words) told that what they were > > shown and told is not the right way to code. On the other hand, having a > > unit test for the 1-liner helloworld.rb seems massively goofy. > > The thing is, all the people who argue that testing first is the right > way to code did not themselves learn to code that way. That doesn't > prove or disprove anything, but it does make me wonder whether > teaching someone test methodology right out of the starting gate is > demonstrably the best way to go about teaching someone programming. I > tend to think it isn't, though I also think that there are good and > bad ways to introduce testing into the mix (the best way probably > being to present it as essentially what they've been doing all along, > but more structured; and the worst way being the "OK, the fun is over, > now let's get serious" stuff). I started on coding sheets. We wrote tests first. We used to "desk check" our code too. We had to, it might take a couple of days to get the cards punched before getting one, perhaps two, compilations per day. I'm in my forties, so this is ancient, but not prehistoric history. That said, I lean towards what David is saying, that it's a skill to be learned after experimenting/playing with code. After all, we all learn to speak before we write. And being able to write well takes a lot more skill than simply being able to write what we say. -- Cheers, Marc