Nick Plante

Dr. Dobb's Bloggers

Objective-J and Cappuccinno

September 15, 2008

There have certainly been some interesting developments in the JavaScript web development sphere lately. Awhile back I wrote about the SproutCore JavaScript MVC framework, which has been embraced by Apple for development of its MobileMe platform. And last week, 280North finally (officially) released their Objective-J library and the Cappuccinno framework, which gives web application developers yet another option when it comes to delivering JavaScript-heavy Internet applications.

There have certainly been some interesting developments in the JavaScript web development sphere lately. Awhile back I wrote about the SproutCore JavaScript MVC framework, which has been embraced by Apple for development of its MobileMe platform. And last week, 280North finally (officially) released their Objective-J library and the Cappuccinno framework, which gives web application developers yet another option when it comes to delivering JavaScript-heavy Internet applications.

The interesting thing about this new pair of technologies is that, unlike SproutCore, it abstracts away the process of dealing with individual bits of JavaScript, HTML, and CSS to manipulate the DOM. In short, Objective-J is built entirely in JavaScript and intended to sort of mimic Objective-C, allowing developers familiar with that language to work with tools they're already familiar with when building interactive web applications. It also adds some useful new mechanisms such as a Ruby-like methodMissing capability.

Of course, Objective-J is really just a layer on top of JavaScript, so don't worry -- any JavaScript you choose to write will work as well. For more information about Objective-J, there's a tutorial available.

Cappuccino is even more interesting. It is -- I kid you not -- a straight port of Apple's Cocoa framework (Foundation and AppKit) to the web. That means that if you're already familiar with these APIs, you can jump into Cappuccino development almost immediately. That's right, you don't need to write a line of HTML, or CSS, or ever manipulate the DOM by hand; developers merely have to learn one new "programming language" (Objective-J), which looks smells and feels exactly like Objective-C for most purposes, and then use Cappuccino to leverage the APIs that they're already familiar with as Cocoa developers to build compelling web applications. Simply create and position UI elements just like you would in Cocoa, and Cappuccino takes care of rendering out the appropriate HTML, CSS, and cross-browser-friendly JavaScript that will be interpreted by the browser. It almost sounds too good to be true and will certainly be a huge boon to any Apple developers looking to move simple desktop applications to the web.

SproutCore's framework, which we talked about previously, also aims to make developing "rich Internet applications" easier by providing a JavaScript MVC framework. But the difference is that it still relies on developers knowing and understanding HTML, CSS, and JavaScript, as well as a new set of conventions. For many of us who are already building web applications, this certainly isn't a hurlde; these are tools we're already intimately familiar with (for better or for worse!). For those of you like myself who find yourself in this position and are *not* desktop application developers, SproutCore's approach certainly seems like a better match as it simply builds on top of skills that we already possess.

On the other hand, if you're already familiar with Cocoa but lacking web skills, well Objective-J and Cappuccino certainly seems insanely compelling. 280North's flagship application (280 Slides) already developed with this set of tools is extremely fluid and attractive. Also, their scrapbook tutorial and sample application make for a great read; a lot of thought has clearly been put into this and it shows.

If you're an Objective C developer I'd definitely encourage you to take a look. If you're already comfortable with jQuery, HTML, and CSS, it may be somewhat more difficult to make the argument to switch, but taking a good read through their tutorials may still be worthwhile. I certainly can't argue with the fact that the number of technologies that we have to be familiar with as web developers is probably much greater than it should be, and it would indeed be nice to embrace a single toolset rather than 3 or 4 inter-related ones. Now if the syntax just looked a little more like Ruby, and a little less like Objective-ive-C...

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task.
However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

This month's Dr. Dobb's Journal

This month,
Dr. Dobb's Journal is devoted to mobile programming. We introduce you to Apple's new Swift programming language, discuss the perils of being the third-most-popular mobile platform, revisit SQLite on Android
, and much more!