In a little over a week it went from being an idea, to being a rough, but functional, sketch of an app, to being a tidy little app that works quite well. Adding reload today was the last major step I had in mind.
Bindings is a lot of what makes it possible. There is actually very little code holding Spike together (see for yourself on GitHub). Most of my effort went into the LogParser class.
Bindings are a little hard to diagnose when they go wrong, fussy to setup in Interface Builder (so much so that, in Elysium where I have vast, vast, numbers of bindings I do them all in code), but they really do make life simple.
I was really left with one main problems to solve: How to parsing the Ruby hash of parameters passed to each request. The other stuff I was lifting out of the request using Cocoa's
NSScanner and looking for prefixes. Parsing potentially deeply nested hash structures required something more sophisticated.
My first reaction was to turn to Ragel again. But I hadn't used Ragel for some time and it seemed a daunting proposition to relearn it and figure out the integration with Objective-C and Xcode. I started Googling for something, anything, easier and quite by chance came up against [Todd Ditchendorf]'s(http://ditchnet.org/) (he of Fluid fame) pet project TDParseKit.
TDParseKit turns out to be a rather neat Objective-C toolkit for assembling tokenizers and parsers and Todd has done an amazing amount of work both creating the kit and creating sample parsers for a range of languages. If you're looking to parse, for example JSON, Todd already has you covered. I still have some work to do on the parameter parser and some requests don't parse properly because of file references (for uploads). But Todd's already been a big help with that. TDParseKit is a very cool project.
The only other major hurdle I hit was a very strange problem that occurred intermittently, more often with some files for reasons I could not deduce, where the results table wouldn't display a row until you clicked on it first. It was driving me nuts.
Fortunately I was able to talk it over with Rainer Brockerhoff author, most recently, of Quay and Klicko. I'm very lucky to be able to call on him as he's both great to chat too (even though we have differening opinions on syntax sugar!) and has a wealth of experience with Mac programming that few I've met can equal.
After talking the problem over with Rainer he pointed out that I was updating a bound property from a background thread. The inconsistency of the problem should have pointed to timing issues & threading but I couldn't see the wood for the trees since I'd already decided it was a bindings/NSTableView problem. Problem solved!
I've learned a bit about table rendering, NSDocument, NSSearchFields, and the joy of using NSPredicate.
All in all it's been fun.
I see v1.0.9 of Spike as relatively feature complete. It does a job and, I think, does it pretty well. I'm now hoping to turn my attention back to Elysium and get a new release of that out the door because I have some cool stuff for it.