Archive for the ‘JS’ Category

Gianduia vs. Flash

Monday, May 10th, 2010

Today, internet is full of stories about the Apple’s secret weapon that will kill Silverlight, Java and Flash once and for all… Again! Sadly this is becoming sort of a cliche (of everyone wanting to kill Flash) and it’s my second article in a row trying to give you a completely different point of view.

The mythical new framework is called Gianduia which relates to Gianduja a sweet chocolate containing about 30% hazelnut paste, invented in Turin by Caffarel in 1852 (wikipedia). I’m betting on a hazelnut reference in the logo once Gianduia is out!

Since early version of Gianduia is already deployed on some parts of Apple.com (here and here), I went to find out what exactly is it. Here’s what I found by digging through the available information and sources.

Gianduia is:

  • A client-side Model View Controller based framework in JavaScript 1.x
  • Cocoa (with CoreData) and WebObjects translated to JavaScript
  • Lots of OS X / iPhone / iPad style interfaces in your web browser
  • Targeted at building HTML5 web apps using Cocoa
  • Meant to unify multiple JS frameworks used by Apple into one piece

What it’s not:

  • A Flash, Java, Silverlight or any other “killer” – it’s just another JS framework running in your browser
  • Portable – it runs in the browser, but it needs XCode+Mac to compile from Cocoa.
  • Self sufficient – it relies on device or browser for delivering video / audio / interactivity to the end user

Gianduia’s direct competition:

So if it’s not the next “Flash Killer” what exactly is Gianduia’s purpose? The answer is simple: Apple are just trying to fix their own loose web application toolset and to put all components under a single unified framework. In this case however they will be competing with other JS frameworks out there such as:

Gianduia’s APIs

At the time of writing, Giandua’s main framework file is located here. Depending on requirements on each application, it would call and load multiple “modules” which appear to be sort of a descriptor files of an equivalent UI element or utility class in Cocoa, just written in Javascript.

For those of you who want to peek under the hood and check the inner workings of the framework, below is a list of some of Gianduia’s framework classes (links to Javascript files). Whitespace has been removed from JS files, but they uncompressed and still more or less readable.

You can see some really interesting stuff here like NSPersistentStore or NSBindingDeclaration, take a look:

Foundation

AppKit

CoreData

The Unusual

While browsing through the new API I noticed a new syntax which probably relates to Gianduia’s data binding features. The following bit comes from a script type="text/declaration" tag located in the head section of Apple iPhone reservation tool.

Maybe someone from readers could provide more ideas on what this code does? Do you think it’s a good approach?

[HTML]

[/HTML]

Impressions

I might be mistaking, but after playing around with the live demos and looking at the sources I think Gianduia is not meant to be written by hand rather than generated by a compiler – syntax is sort of unusual, hacky and difficult to read.

However even in this case Gianduia will have a slight edge over other JS frameworks due to the fact that it’s developed by Apple; This means if this framework ever gets released to the wild you can expect very tight integration with XCode and ability to choose “web” as a compile target for your next Cocoa application.

The dark side of this is the new language lock-in trend that starts to emerge – it seems that Apple wants everyone to write their code only with Obj-C in XCode, on a Mac and compile to other platforms, but not the other way around.

As far as the demos go, I was not impressed. What I saw was pretty basic and static web forms and still the UI components did not seem very responsive. I would really like to experience this framework integrated in a more advanced web application to test how well it performs handling difficult tasks.

Gianduia seems to have implemented a dependency model which results in chain-loading of framework components. At one point during my test of Apple iPhone reservation tool I had user interface frozen (with unresponsive inputs and no preloader) for 12.7s while the dependencies were loading in the background – that’s a bad user experience!

Conclusion

It’s shaping to be a nice extension for developers using XCode and a solid framework for building layout based HTML apps but we will have to wait and see if it’s anything more than that.

Just don’t put your bets on Gianduia killing Flash –

it just won’t happen.