Matt Gemmell

TOLL is available now!

An action-thriller novel — book 2 in the KESTREL series.

★★★★★ — Amazon

Cocoa vs REALbasic

source 4 min read

Now there’s a topic that everyone seems to get really worked up about. Is Cocoa “better” than RB, or the other way around? Which is easiest to learn? Are RB apps just unmitigated crap from start to finish? Are RB apps more buggy? Here are a few freeform thoughts on the subject.

Which is easiest to learn?

Difficult to answer this one, which is a credit to both REAL Software and the NeXT/Apple framework developers. RB is certainly readily picked up, and is a mature and powerful language/environment. You really can make useful apps in very little time with it. Its idea of writing your code “inside” the UI element you want it to affect is immediately intuitive from a newcomer’s point of view, and certainly helps keep your code modular. There’s a huge wealth of sample code and applications available, and (last time I checked), a very active and helpful community. There are O’Reilly books on RB, and plenty of websites too. It’s not a toy, by any measure.

Cocoa is rarely asked to defend itself against allegations of being for beginners only. It’s extremely mature, and the richness of the frameworks continues to impress me almost daily. I think it’s very readily picked up, but it does require a basic knowledge of C (or at least a significant subset of C, for the most part), and at least a cursory understanding of what a pointer is and so forth. I’d have to say that Cocoa is more difficult for absolute newcomers, if only because I think that RB is really onto something with its ability to write code immediately, i.e. as soon as you have a UI. With Cocoa, you still need to create your classes, your controller objects, instantiate them and connect them up in IB before you can really get down to things. Also, the fact that RB is completely integrated into a single app is a plus, whereas IB and PB remain separate (as indeed they should, but that’s another post). Overall, I’d be forced to say that, for absolute beginners, RB is easiest to learn. For those with even a basic knowledge of C, though, Cocoa/Obj-C will be more natural. It’s a matter of background.

It’s worth mentioning here that I don’t think RB any longer offers an advantage for RAD development. With Cocoa’s richness and flexibility, and the wondrous Interface Builder, you really can prototype an app just as quickly using Cocoa as you can with RB.

Which is better?

This is the question everyone debates, which is strange because I don’t even understand what it’s asking. Surely the answer must be that neither is “better”, in any general sense? Cocoa has the advantage that it’s incredibly mature, flexible, and provides first-hand access to pretty much all of the Mac OS X goodness. It’s also free to get the world-class tools you use to develop with it, which is a big plus. RB has the advantage of being really easy to learn, a huge userbase and community, and much more importantly it brings more applications to the Mac. We can probably do without our 900th SimpleText clone, but there are some absolutely brilliant apps out there created exclusively with RB. RB also makes developers out of those who otherwise wouldn’t even attempt programming. I don’t believe that RB makes developers out of those who otherwise would not be capable of programming, because I don’t think that Cocoa is inherently any “harder” for someone with appropriate experience (say with basic or scripting for RB, or with C for Cocoa). Like it or not, RB apps still deserve a fair bit of credit for keeping VersionTracker’s listings ticking over day by day, and choice is a great thing.

Are RB apps inferior to “proper” applications?

I don’t really see what people mean when they say “proper” applications. In every meaningful way, an RB app is like any other app. You can create crap using just about any language or environment. Certainly, since there are perhaps relatively more programming beginners using RB than using Cocoa, there will be a correspondingly greater number of “my first app” programs, which are naturally released in the initial surge of pride. That’s all fine. It doesn’t indicate that RB is somehow only capable of producing such apps. This also brings me dangerously close to writing about something I really hate: the idiotic “reviews” some people write on VersionTracker. But we’ll save that for another day. A carefully-written RB app is just as “good”, in whatever sense, as a carefully-written Cocoa app. That’s just basic common-sense. I can’t understand why people might think otherwise.

Are RB apps more buggy?

This is based on the assumption that RB apps have two potential “levels” of bugs; those introduced by the RB user, and those introduced by the RB developers at REAL Software. That’s potentially true, and as RB is younger than Cocoa and has a smaller development team, it probably has an actual basis in truth too. But, let’s be realistic: RB has been around for years, with many users, a lot of whom are producing serious shareware and in-house applications on a regular basis. RB really is quite mature. I don’t think that, all things being equal, RB-made apps are significantly more buggy than apps created anywhere else. Again, it’s down to the individual developer.

Final thought

Both RB and Cocoa really lend themselves to rapid development. In the time it takes to post a “more RB crap!” comment on VT, you could likely have made significant progress in your own development environment. Concentrate on user experience and features, rather than mocking what the other chap is using.

Grab my Cocoa source here.

Grab some of my old RB source here.