Wednesday, May 30, 2007

BOF-6012 Javascript Programming Language:

Best Practices for Developers on the Java Platform

2007 8 May, 20:00
Tuesday

Eugene Lazutkin, Sun (Dojo)
Gregory Murry, Sun
Sang Shin, Sun (javapassion.com)

http://www.javapassion.com/ajax/BOF-6012.pdf

General JavaScript ideas and idioms
Peter-Paul Koch's Quirksmode web site:
http://www.quirksmode.org/js/
Douglas Crockford's web site:
http://www.crockford.com/javascript/
Please read his articles on “Classical inheritance...” and
"Prototypal inheritance...”

http://dojotoolkit.org/
http://www.jslint.com/lint.html

Javascript code is essentially an execution tree where functions are first class. A form of inheritance is implemented as prototypes. Prototypes allow the addition of members to existing classes. At a theoretical level, Javascript is more powerful that Java because of the prototype feature.

Javascript, or, really, ECMAScript, was never intended to be a full-featured programming language. The goal was simplicity. Perhaps the most useful thing that could be added to Javascript, while keeping to the KISS principle, is modules and namespaces. Namespaces provide reference integrity, while modules allow the bundling of various js files.

jMaki is a widget gallery. jMaki allows selective use of features across js libraries.

Dojo provides packaging: namespaces, packages, modules; OOP: constructors, inheritance.

So for a namespace,
var dojo = { }
dojo.gfx = { }
creates the dojo.gfx namespace. Syntactic sugar with
dojo.provide("dojo.gfx")

dojo.require(“dojo.gfx.path”);
Loads the path.js file from the gfx directory of the source tree. path.js is a module and gfx is a package.

Dojo provides internationalization and accessibility. Dojo provides infrastructure.

No comments: