I hate writing tests. Tests are awful and I'm awful at it. I just spent two hours writing the most basic tests for XML::SAX::Writer (v0.39 headed for CPAN), caught a bunch of bugs along the way (which proves just how much tests are needed), and my head hurts with repetitive concept syndrome.
And as I said, I've still only tested the most basic parts. That is, the means to output XML should work, but there's no guarantee that the XML itself is good. There are many more tests I need to write, and of a much harder kind.
I wish I could buy into all that XP thing, or other methodologies that emphasize testing before you even have something. I really wish I could but my brain just doesn't work that way. XML::SAX::Writer is a particularly bad example because I needed it immediately, and so wrote it without having the time to test anything more than what I needed that very second. After that there was a long time during which I didn't have time to touch it much. And of course, there were bugs, tons of them. Very bad and very scary ones
In any case, I hope this version with its small complement of tests will fare better than the previous ones.
Hardwired vs learned (Score:2, Insightful)
I'm still not fully transmorgified into a test-first programmer, but IME it can be a learned behavior. With enough practice and motivations -- which it sounds like you've already found -- it becomes easier and easier to do. The big motivations are when you find yourself saying "Wow, writing tests for that really saved my ass."
A nice side-effect is that I wind up creating simpler interfaces and only creating what I need at that time.
Re:Hardwired vs learned (Score:2, Interesting)
Schwern once said that people panic and go into dummy mode when confronted with writing tests. Good programming practices go out the window. Sure, there's untestable stuff, but if I can test Term::Complete without changing the in
Re:Hardwired vs learned (Score:1)
Thanks for the encouragement, but I'm still doubtful that I'll get to become a test-first guy. The problem is that the way I work (for anything) is mull, mull, mull, then braindump. If that braindump happens to be good, then it's good; if not I throw away. I don't see myself changing that to mull, mull, test, then braindump; especially as, in truth, it is the mulling I enjoy much more than the actual coding ;-) I guess that's what happens when a french intellectual turns to hacking...
There's also t
-- Robin Berjon [berjon.com]