Some code that I wrote
Between working on various client projects, I've been hacking away at various new open source projects over the last month or two that I want to share.
I've been meaning to write a more detailed blog post about most of these but just haven't found the time. I still plan to cover each of these in more detail but I just wanted to get this out there in the meantime.
Yes, another one. LRResty, is a simple Objective-C client for interacting with REST web services, modelled on the excellent RestClient Ruby gem.
When I started LRResty, I had the following objectives in mind: it should have a clear, succinct API, it should be decoupled from your domain model, it should build upon proven APIs (NSURLConnection, NSOperation) to provide asynchronous behaviour and it should take full advantage of Objective-C blocks.
Here's what it looks like:
Like RestClient, LRResty can be used in a more resource-oriented fashion:
There is some other cool stuff like request modifiers, small blocks that can be used to modify all requests before they are dispatched which are a really easy way of doing things such as adding authorization and content-type headers to all of your requests, but I'll cover these in more detail in another post.
Why JMock? Having recently read this brilliant book, which uses JMock in a significant way, I grew to appreciate its API and felt that it was a better fit for Objective-C then something like Mocha, my Ruby mocking library of choice.
LRMocky tries to mirror the JMock API wherever possible although it is not always possible due to syntax constraints. Here's a brief example:
I'll keep this one brief because the README says everything you need to know.
Having written one too many implementations of a UITableViewController and attempted several different ways of abstracting the repetitive nature of UITableViewDataSource, I finally hit upon the table model concept, as used by the Java Swing JTable API.
This project is still in it's early days but my early experiments seem to indicate that this abstraction works. More to come on this one.
A late entry, Mimic is a small Ruby library that I've been working on in the last couple of days.
It builds on top of Rack and Sinatra and provides a really simple way of starting up a server to act as a stand-in for an external API that can be used when writing integration/end-to-end tests.
Because it actually starts up an HTTP server it is not limited to testing Ruby apps or libraries (ala FakeWeb or WebMock) and I have some interesting ideas on how it can be used when testing iPhone apps (you can see this idea in the acceptance tests for LRResty, which fires up a Sinatra app during it's build phase to perform tests against).
Mimic is available as a gem.
As always, I'm interested to hear any feedback people might have on my open-source projects. I'd also love to hear from you if you are using any of my code in one of your projects.
You can drop me an email or send me a message on Twitter. If you'd like to keep informed of the progress of any of these projects, the best way is to simply follow me on Github.