Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

samtregar (2699)

samtregar
  (email not shown publicly)
http://sam.tregar.com/

Journal of samtregar (2699)

Tuesday September 23, 2003
10:21 PM

XML::Validator::Schema and Test Driven Development

[ #14870 ]
I've finally gotten my hands dirty with XML::Validator::Schema. I'm using it as a test case to try out Test Driven Development, as I learned it from Test Driven Development: By Example.

So far it's been a mind-bending trip. If you don't know, TDD is about writing tests first, coding just enough to make all the tests pass and then refactoring to reduce duplication. The result is hopefully lean, well-tested code with less risk of failure and less wasted effort.

I'm utterly surprised by just how much refactoring I've been doing. I've added sub-modules, removed them and added them back. I've removed more methods than I've written. As each test case goes in the entire architecture of the module comes up for review. It's a refreshing process, and the results so far are pretty good. XML::Validator::Schema is probably 30% of the way to replacing Xerces/C++ on my latest project, after only 3 days of development.

In some ways this is the ideal TDD project because I have no idea what the architecture of an XML Schema validator should look like. As I add new test cases I can evolve the design to handle the added complexity. And with a standardized file format like XML Schema I've got a wealth of potential test cases at my fingertips and little opportunity to write bad tests.

The only downside I've found so far is that I'm not writing very much developer-focused documentation. Knowing that the code will likely change radically very soon puts a damper on writing baroque descriptions of how things work. I guess I'll find out how much of a problem this is when I get to maintain the code later...

-sam

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.