Thursday, March 3, 2011

Non-web Javascript frameworks

Are there any good JavaScript frameworks out there which primary audience is not web programming? Especially frameworks/libraries which improves the object orientation? The framework should be usable within an desktop application embedding a JavaScript engine (such as Spidermonkey or JavaScriptCore), so no external dependency are allowed.

From stackoverflow
  • Objective-J(avascript) is one. Is that the kind of thing you are looking for?

    Johan Dahlin : Not really. I'm just looking for a framework, not another language.
  • The most widely known one is XULRunner from Mozilla. This is framework that FireFox and Thunderbird are built on.

    https://developer.mozilla.org/en/XULRunner

    Although not strictly javascript only, it incorporates a host of technologies closely tied to web for the purposes of building desktop applications.

    Johan Dahlin : I'm actually using the javascript engine (spidermonkey) from xulrunner, but I don want the rest of the technoligies related to firefox such as gecko,xpcom,xpconnect etc. I have my own replacement for those.
  • Have you looked at Adobe Air? It allows you to use JavaScript/AJAX to write Desktop applications.

    http://www.adobe.com/products/air/

    Johan Dahlin : Not interested in web stuff. Besides, is air really free software?
    OscarRyz : You never mentioned 'free' Johan.
  • As far as "improving object orientation" goes, Javascript is already great. You just need to get used to thinking in prototypes instead of classes.

    After reading Douglas Crawford's great page on prototypal inheritance I really started to enjoy working with javascript. (He also has a page on class inheritance if you must use classes.)

    Edit: If by asking for a framework you also mean, helpful libraries that don't use the DOM, you might be interested in Functional Javascript.

    Johan Dahlin : Well, Javascript as a language is rather chatty, at least for me who is coming from a python background. A framework to reduce the amount of typing needed would be great.
    Matthew Marshall : I'm a Python user too, so I know what you mean :) For me the biggest pain in javascript is the for loop, but the Functional library mentioned in my edit *greatly* helps that.
  • Dojo can be used (and is used) in non-browser environments (e.g., Rhino, Jaxer, SpiderMonkey). It can be easily adapted for other environments too — all DOM-related functions are separated from functions dealing with global language features.

    dojo.declare() (more docs) comes in the Dojo Base (as soon as you load dojo.js) and implements full-blown OOP with single- and multiple- inheritance, automatic constructor chaining, and super-calls. In fact it is the cornerstone of many Dojo facilities.

    Of course there are more low-level facilities like dojo.mixin() to mix objects together and dojo.extend() to extend a prototype dynamically.

    More language-related features can be found in dojox.lang. Following parts of it are thoroughly explained and documented: functional, AOP, recursion combinators.

    Dojo comes with other batteries included from string-related algorithms to the date processing. If you are interested in those you can discover them yourself, or contact the Dojo community.

0 comments:

Post a Comment