My latest fad is looking at developing Mac apps (in Cocoa). Since the Leopard upgrade, Objective-C 2.0 has Garbage Collection. Congratulations Apple, you’ve lifted it out of the dark ages.
So, I’ve been trying to read up bits in ADC, but my time is limited. This means I turn to podcasts like Late Night Cocoa which I can listen to during my commute.
Today, I was listening to the latest Mac Developer Roundtable, Testing Testing Testing. Neat, I wondered how to do unit testing in Cocoa.
Sadly, the discussion was like asking blind people to critique a painting. None of the participants (save the host, Scotty) actually knew what Unit Testing was, or had ever done any. It was the most ill informed discussion I’ve had the misfortune to hear in a long while.
“asserts are just another form of unit testing.”
“Well, I know my code, so I don’t have to bother with unit testing.”
“Unit testing doesn’t give any value.”
(all paraphrased, but it’s the gist of things).
It’s weird, sort of like jumping back 10 years in time. Like the whole agile thing never happened.
Now, I completely accept that XCode might have terrible support for unit testing. It’s possible, I have’t got that far yet. Likewise, OCUnit might be hard to use. But that doesn’t negate the value of knowing that you’ve fixed something and don’t have to go back to it.
This is particularly surprising, given the high quality of what I’ve seen in Cocoa so far. Apple is big on design patterns. In particular, MVC plays a huge rôle in Cocoa apps. Controllers and Views might well be hard to test, because they’re part of the GUI. But your Model (which is the core of your application) should really be amenable to testing.
I really hope that the rest of the Mac development community isn’t so stuck in the dark ages.
2 replies on “Unit Testing falsehoods”
I’ve been noodling around with RubyCocoa (which also ships with Leopard…yey!
So far, so good. It’s better than Objective-C and the new bindings are much better than CamelBones (ObjC/Perl bridge.)
Just a thought.
Thanks, I noticed that it was meant to be much improved in Leopard. I just hadn’t gotten around to playing with it yet.
To be honest, I don’t find Objective-C that objectionable. It was just the attitude towards testing that really irked me.