Slash Boxes
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 ]

merlyn (47)

AOL IM: realmerlyn (Add Buddy, Send Message)
Yahoo! ID: realmerlyn (Add User, Send Message)

See my home page [].

Journal of merlyn (47)

Thursday June 08, 2006
10:52 AM

In praise of good testing

[ #29842 ]

In my work for $client, last week I spent a few hours making sure that Devel::Cover was mostly happy with my code, running through enough branches so that when I had to "go live" with minor revisions, I could push the change with a fair degree of confidence.

This week, I concluded that a fundamental data structure (an in-memory hash-of-hashes) that controlled the entire operation and was passed from one part to the next of this 2000-line set of modules, should be changed to be permanent.

So I pulled out Rose::DB, designed a simple main-row-plus-1-to-n-children database schema, and started refactoring. Of course, after I got rid of the initial data structure, every test failed. I would take each test, run it, and watch it fail, and then I would keep hacking the code and fixing it again until the test passed. Then I'd move on to the next one.

Six hours later, my complex application was now completely running with Rose::DB-based persistence instead of an in-memory data structure. And I was very happy that the client had insisted on complete tests before I started, because I was now confident to push this new version into production.

Tests. Not just for breakfast, any more.

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