Mocking Is So 2008
Pat Maddox recently published a blog post on mocking called “You Probably Don’t Get Mocks.” I wanted to write something on my experiences with mocks for a while now, so here’s good reason to finally do so. I’m a recovering mock addict, if you will, so this is my retribution of things I learned over the last 18 months, and how my testing workflow changed with them.
Keep It Simple
It seems to be common sense these days to throw a search engine, a database slave or an external cache at your application in even the earliest stages of a project. Let me just give you my two cents on the issue, and why I think that’s a bad idea.
When Overusing self Turns Into self.pity
There’s something I see in lots of projects is an overuse of self
. Sure, it looks a lot nicer than this
, but its overuse can clutter code quite easily. Here’s a rather simple example.
Hello From Jekyll
I got a little sick of having to maintain an unmaintained blog engine (I’m looking at you SimpleLog), so I did what all the cool kids are doing, I switched the blog to using Tom Preston-Werner’s excellent Jekyll. I threw in a few tweaks of my own, and tweaked my Rakefile and Apache to support things that SimpleLog can do, but the static nature of Jekyll can’t. Thankfully, the URL format of both is pretty similar, so it was pretty easy to set up redirects from the old URLs to the new ones.
Cocoa Lessons Learned #1: Threading is Hard
While working on iMacistrano (or iWebistrano if you fancy, either way my little iPhone toy project) I started moving things into background tasks and to use timers to fire off requests on a regular basis, specifically to create a deployment, and then to monitor its state.