Project X report
Jun. 9th, 2008 10:06 am![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
X is chugging along nicely. The skeleton of the logic library is complete, and I'm now fleshing it out through writing a whole mess of unit tests, making sure all the muscles twitch just so. It's hard to imagine a time when I didn't make a habit of test-driven development, even though I started only a couple of years ago. Seeing the panel of lights glow green after adding code is a happy thing, and seeing some turn red is happier, in a way, because I know that here are errors I wouldn't have caught until much later without the tests handy.
I'm champing at the bit to start working on the UI, partly because it terrifies me. But I'm not letting myself do so until every class (or at least every class of class) has at least a couple of tests attached, and there are a lot of classes. There's probably another two or three full work-sessions of test-writing in front of me, and when I do start building the UI I know I will be on my knees thanking my past self for having the patience to do them first.
Moreover, it's past time to seriously engage the game's rights-holder about what they expect to see on their end of the licensing deal. I made a gesture towards this over email last month, and they acknowledged receipt, but we need to have an actual conversation. I've been putting it off because it's less fun than working on code by myself, but I have long since proven to myself that I can accomplish the technical end of this task. Time to refocus long enough to TCB.
I'm champing at the bit to start working on the UI, partly because it terrifies me. But I'm not letting myself do so until every class (or at least every class of class) has at least a couple of tests attached, and there are a lot of classes. There's probably another two or three full work-sessions of test-writing in front of me, and when I do start building the UI I know I will be on my knees thanking my past self for having the patience to do them first.
Moreover, it's past time to seriously engage the game's rights-holder about what they expect to see on their end of the licensing deal. I made a gesture towards this over email last month, and they acknowledged receipt, but we need to have an actual conversation. I've been putting it off because it's less fun than working on code by myself, but I have long since proven to myself that I can accomplish the technical end of this task. Time to refocus long enough to TCB.
no subject
Date: 2008-06-09 03:47 pm (UTC)For example, having done a lot of hardcore numerical programming on Intel architectures, adopting a test-driven approach taught me a few years ago that a lot of the math is done in 80-bit registers internally, which creates miniscule changes to 64-bit arithmetic depending on initialization conditions. This kind of thing gives any sane set of numerical tests fits, because it can make the difference between a "near miss" and a scatter in multi-particle Monte Carlo simulations, and means that at best you need different tests for debug and release code.
My approach has therefore tended strongly toward imposing runtime post-conditions on processes--in physics code, things like energy conservation, for example--which is certainly test-oriented, and keeps my bug-count extremely low, but is quite different from the usual external test suite that real test-driven developers use.
If you have any pointers to good resources for test-driven development I'd be interested in looking at them.
no subject
Date: 2008-06-09 05:16 pm (UTC)That said, the tests I end up keeping tend to be pretty high-end, taking the software as a whole and bashing it through a gantlet of artificial test cases. This might not be what purists would call real TDD, where every single method needs a test hanging off it.
The book that taught me about test-driven development is "Perl Best Practices", which, yes, isn't necessarily a good generalized source (even though it did change the way I write code in all languages). Anything else I could point you at would be borne from the obvious Google searches.
no subject
Date: 2008-06-09 05:24 pm (UTC)Method-level testing is the kind of thing I use internal constraints for. Higher level testing, ideally with tests that can be tied to design goals, is the thing I'd really like to automate.
no subject
Date: 2008-06-09 09:26 pm (UTC)I generally find that unit tests fit really well with some levels of the project, and make no sense for other parts. I never wrote any tests at all for Volity Fluxx, for example. But there are lots for various pieces of the Python parlor framework that I wrote Fluxx on top of.
(I could explain why this happened, but it might wind up as an argument for Jmac to stop writing Fluxx unit tests!)