Test Driven drudgery
I've been working on a JNI layer to the iXmatch matching engine. Lots of the JNI code would really be amenable to a code generation system. I'm opposed to code generation most of the time, but this is one area where it feels like it would make sense. Once it's done, I might have to go back and look at what I can abstract out from this.
In the interest of having rock-solid code, I'm writing a substantial test suite to exercise the various elements of the API. The tests would also lend themselves to automatic generation, or at least a macro to spit out most of the setup and teardown code that's specific to each method.
Doing the tests is an interesting exercise in discipline. I feel a LOT slower than I usually do when I'm coding. There are two reasons for this, as near as I can tell. The first is that I gotta write the test, so I'm writing 2x the amount of code I usually do. The second is that writing JNI code isn't that much fun. I suppose it's what writing Objective-C would be like without any compiler support and you had to invoke the objc runtime manually.
However, there's a payoff. The code feels a lot more solid at this stage in the development cycle than I'm used to. That's pretty damn cool, and is probably worth the effort. Now if only I could find some way to make the JNI side of things less painful.


0 Comments:
Post a Comment
Links to this post:
Create a Link
<< Home