Java Developer... Meet JavaScript

You've seen it around, it's been exhaulted as the saviour of web-based interaction, dragged through the mud as a security disaster suitable only for newbies and script-kiddies, and recently recast by some as the foundation of Web 2.0. It's none of the above, yet lends to all of them for good or ill.

Why am I posting this? I am posting it because I believe that the J2EE community has been unwilling to seriously adopt JavaScript as a foundational component of their development. With tools such as The Dojo Toolkit it is now possible for Java-centric developers such as myself to develop in JavaScript without our heads exploding with worry about global-scope collisions and undeclared dependencies. In fact, I'd wager that a Java developer who invests his Digg time instead on learning Dojo and by proxy JavaScript itself, will find Java less and less compelling as the power of closures, true Aspect-Oriented Programming, and literal object and regular expression syntax sinks in.

A simple example of JavaScript's powerful literal syntax: "CustNH".split(/(?=[A-Z])/) returns ["Cust","N","H"]. This is effectively a very concise CamelCase parser.

Imagine now that you are using this string to drive an Autocompleter such as the one from You can now do completion from CamelCase to search an API to give a result like CustomNavigationHandler (for those familiar with JavaServer Faces).

That's just a trivial example but it illustrates how concise JavaScript is. In my next post I will discuss why UI events are best handled by the client-side and explore the idea of using Dojo and a RESTful JSON Server to push the Controller and Template Rendering responsibilities to the client.

Conclusion: JavaScript is well worth the effort to learn.

See: A re-introduction to JavaScript on Mozilla's site for a cross-browser intro to JavaScript.