Last week's news about Apple's use of SproutCore triggered a lot of discussion about the future of rich Internet applications, run-time environments, and JavaScript frameworks. While SproutCore has been referred to as "Cocoa for the web," its developer Charles Jolley says that the framework was "inspired by Cocoa," not really a port of Cocoa. But what if someone ported not just Cocoa, but also an Objective-C runtime that runs entirely in JavaScript via a browser? Well, the developers at 280 North did just that.

280 North formed earlier this year when three friends from USC got together to realize their dream of working together to develop software. Francisco Tolmasky and Ross Boucher graduated from USC in 2006 and 2007 respectively, and both spent some time working at Apple; Tolmasky on iPhone development and Boucher on back-end server technology for iTunes. When Tom Robinson graduated in January of this year, the three formed 280 North to develop their first application, called 280 Slides.

280 Slides is a very impressive presentation app that looks and works very similar to Apple's critically-acclaimed Keynote. Anyone familiar with Keynote or the ubiquitous PowerPoint can easily create a well-designed presentation with nothing but a web browser. Though Slides lacks some of the features of other web-based presentation apps, it tends to favor simplicity and elegance and is still highly serviceable for most needs. The app also runs smoothly and seamlessly. On Mac OS X, it's easy to forget that it's running in a browser and not directly on the desktop.





280 Slides is heavily inspired by Keynote, with a clean and simple interface.

"We actually started some of the technology behind 280 Slides while we were still students [at USC]," said Boucher, who talked to Ars about the pair's work in creating the 280 Slides. "Actually, Francisco wrote Objective-J right before graduation, and then we sort of set the project aside until right about the time we left Apple." Objective-J is an implementation of message passing in JavaScript, complete with Smalltalk-style, square bracket syntax. It's a superset of JavaScript, in much the same way Objective-C is a superset of C, so developers can easily switch between Objective-J and Javascript syntax as needed.

Objective-J runs entirely on the client-side without the need of any server-side run-time or browser plug-ins. "We built a client side preprocessor that takes in Objective-J and translates it into native JavaScript. And we also built the Objective-J runtime to go along with it, so you get objj_msgSend()," Boucher said. The JavaScript is then executed directly via the browser.

With this technology in place, the team then created a port of Cocoa, the frameworks included in Mac OS X that allow for relatively easy and rapid development of GUI applications. They call their port Cappuccino. "Cappuccino is a re-implementation of Cocoa in Objective-J, which means we reimplemented AppKit, Foundation, CoreGraphics, and parts of CoreAnimation," Boucher told us. With it, developers familiar with desktop GUI applications can create a rich, desktop-like web app with the same relative ease Cocoa programmers can create a rich desktop app. "Coming from a background of desktop programming, and Cocoa in particular, we realized how much harder building a web application was. So we wanted to try to make things just a little bit easier."

Whereas SproutCore seeks to "embrace the platform" by giving a Cocoa-like development model for developers already using HTML, CSS, and JavaScript to make a web app, Cappuccino and Objective-J take an entirely different approach. "Since Cappuccino runs entirely on the client, at run time, we're never actually generating HTML or CSS," says Boucher. "When you build an application in Cappuccino, you don't need to ever deal with HTML or CSS. All of your interface is designed in Objective-J and Cappuccino. Cappuccino focuses on application architecture more than anything else, like building applications that know how to save and open documents, or copy and paste. We also built a powerful graphics engine into Cappuccino, so you can make rich applications like 280 Slides."

The framework is designed from the ground up to essentially hide the implementation details from the developer. "AppKit does generate DOM elements, but, in many ways, the DOM is just an implementation detail for us. If tomorrow every browser implemented SVG, and we thought Cappuccino should really run on SVG, we could rip out the guts and replace some of the code in AppKit and suddenly every app on top of Cappuccino would be running on top of SVG," Boucher said. Cappuccino-based apps run in Safari, Internet Explorer, Opera, and Mozilla-based browsers like Firefox. And by nature of running in the browser, the apps are compatible with Mac, Windows, or Linux. "There are some issues with IE6—the lack of transparent PNG support, for example. But we've worked through as much of that as possible on our end in Cappuccino. So, as a programmer, this means you're never worrying about browser specific details."







Here is example code for a class that rotates an image: on top is Objective-C,

on bottom is Objective-J. Click each image for a larger version.

The approach has its downsides, though. Developers unfamiliar with Cocoa will have a steeper learning curve to pick up the framework and get accustomed to the message passing syntax. Also, Objective-J has to be parsed and converted to pure JavaScript before it can be run, which can slow initial page load. For instance, "SproutCore is in JavaScript, and it leverages the built-in classes of JavaScript, so SproutCore ends up using a lot less code and it doesn't need to be parsed twice in the browser," SproutCore's Jolley told us. Boucher added, however, that the company has a tool "to preprocess Objective-J code ahead of time, so you save client side execution and load time."

But there are advantages to the client-side preprocessor. Web app developers are used to rapid development cycles—"They make a change, hit refresh, and see it on the screen," Boucher said. "There's been a lot of push away from compiled languages and towards interpreted ones lately, because it can often make the development process a lot faster—especially with heavily UI based code. We didn't want to lose that when you're programming in Objective-J." And it doesn't require installing anything extra to work. "Just point your browser at your index.html file and your app will load." As performance improvements to JavaScript are made, like WebKit's use of the SquirrelFish interpreter, the extra time required to preprocess before the app starts running becomes less and less of an issue.

Boucher tells us that 280 North "want[s] to see the next generation of apps take off on the web. We think Cappuccino is the best way to build these kinds of applications, and obviously we want as many people to use it as possible." So, like SproutCore, Cappuccino and Objective-J will be open source. "We've been working really hard on 280 Slides over the last few months. Now that Slides is out in the public, we need to take a little bit of time to polish up Cappuccino before we release it publicly. I don't know the exact timeframe, but we're just as excited as everyone else to get this in other people's hands."

With the increased interest in web-based software these days, having at least two complete application frameworks to build applications is a nice luxury. Both are open source, both are based on JavaScript, and neither rely on external plug-ins. While SproutCore adds a MVC model to a HTML+CSS+JS development workflow for experienced web developers, Cappuccino gives desktop app developers a way to directly apply their knowledge without having to learn all the ins and outs of the box model and browser-specific tweaks. Jolley told us, "I think in the long run the frameworks that work best embrace their platform instead of trying to hide it. But the 280 North guys and I debate that a lot." No doubt the debate will rage further with Adobe AIR and Flash and Microsoft's Silverlight and .NET in the mix, all mingling with Django, Rails, Java, and other development environments. But from what I have experienced using 280 Slides, a future with Cappuccino based-apps is a bright one.