Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If the DOM is annoying, jQuery is no better. It's DOM++, at best. jQuery is still the DOM, just slightly prettier. If you really believe the DOM is annoying, why not just get rid of it?

People embrace the DOM because its there, but that isn't necessarily a good reason. If jQuery is the C to DOM's assembly (not a particularly apt analogy), why shouldn't we want to branch out to a higher level language? That's one of the reasons we built Cappuccino.

Cappuccino is built on top of the DOM, because its the only thing that makes sense right now in the browser world. But we do our best to make sure developers don't need to worry about the DOM. Of course, as Spolsky would tell us, all abstractions leak and ours is no exception. But, Objective-J is just JavaScript. All the DOM is still there for you to poke at if you must. And the point of Spolsky's article was not that abstractions are bad, just that you should learn what you're abstracting, then use it. Abstractions do save us time, even when they leak.

As far as Objective-J itself is concerned, there were clear motivations for building it. JavaScript lacks dynamic message sending. It lacks classical inheritance. It lacks an import mechanism. We looked at what we felt was missing, and what the best way to fix it was. Turns out, Objective-C was created with exactly these same goals. It was a natural fit for what we needed, right down to implementation level details.

It's important, then, to realize that Objective-J is not about being Objective-C in the browser. It's a better JavaScript. It's a strict superset, so if you just want to use JavaScript, go ahead. If you want to benefit from our hard work and new features, like dynamic code importing, then you can use Objective-J. It even has a REPL: http://tlrobinson.net/misc/console_bookmarklet.html (and a command line version, objj)

Objective-J is also far different in its implementation than Pyjamas or GWT. It's nothing but a preprocessor and a dynamic runtime. It is not a compiler. This means that, in general, the post processed code looks like a slightly uglier version of what you really wrote.

    [object message]
is just

    objj_msgSend(object, "message");
In that small syntactic change, you're actually conveying a great deal of meaning, and enabling some really powerful features. All with effectively no run-time performance cost, and with no need to compile since the Objective-J preprocessor runs in the browser.


Some of that sounds very impressive. Truth be told, I haven't played with Cappuccino much yet - but your post just inspired me to go take a closer look at it. Thanks.


The reason people use jQuery is because the default mechanism for accessing elements is longwinded and ugly. It's the exact same reason people use xml.etree.ElementTree over the W3C-style xml.dom.minidom in Python's standard library. Assuming that people want rid of it completely because they want a better interface is a rather bold assumption, especially when you consider the flexibility using the DOM provides.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: