oscartheduckin’ around

November 8, 2009

test driven development

Filed under: Uncategorized — Tags: , , — oscartheduck @ 9:16 pm

So, it’s been a while since I’ve done this.

 

Test driven development.

 

I’m taking the time out on tabbr to refactor completely with test driven development from the bottom down. Why? Because I’m so fucking sick of small errors appearing because I was reworking code slightly and didn’t notice a typo, or a cmd-X and cmd-V took a wrong character with it because of a bad selection or something similar.

 

The latest misfire: I just discovered that a dump of an object to yaml is coming back with dumping the false object instead. When did this error happen? It’s such a simple thing, what the fuck is going wrong? All I can imagine is that an array that’s being initialised in the object creation isn’t being created properly, because I’ve been working on methods that alter data structures. And that’s simple to find and fix, but I should have something automatic that’s telling me about it. Maybe I can write a pre-commit hook in git that runs all the tests, as soon as I’ve written them up.

 

I’ve been writing code too long to keep ignoring what is, really, the basis of the current vogue trends for behaviour driven development and the like. Test driven development is the real basis that makes agile programming completely doable, and I’m not doing myself justice by ignoring it.

 

I did have some shell scripts I was keeping up to date that did similar things, but dumped the output of a bunch of config files to stdout instead of just being automated testing suites that’re built in. Serious duplication of effort somewhere there.

 

Blah. I should learn from the crowds more.

Blog at WordPress.com.