Maintainable Web Development without JavaScript
In the years 2002-2003, Internet Explorer captured 95% of world-wide browser market share. It was unfathomable to many that over the next 10 years IE would decline to just over 15%.
The open-source community perceived a problem with yesterday’s browsers and put forth a solution – alternative browsers took root despite the best efforts of the domineering incumbent. In this light it would seem silly to think there isn’t yet another radical change waiting in the wings of today’s browser landscape. As all major browsers automatically upgrade to maintain an up-to-date “evergreen” status, the barrier to change has never been lower.
Evolution Away From JavaScript
JavaScript is the only game in town. Even with all its design inadequacies and outright logical flaws, client-side programming can only be done in JavaScript. An army of libraries attempt to monkey-patch fixes, such as jQuery, Underscore, FuncJS, Require. The diverse array of choices only muddy the picture as each address an overlapping portion of responsibility – users are often left sorting out conflicting combinations in an attempt to recreate a full-feature language.
Other attempts to creating a workable veneer are transpiled languages, tools generating JavaScript from a purportedly cleaner source. They range from simple language augmentations fixing the obvious: Coffeescript and Microsoft Typescript, to full language replacements: Google Dart and emscripten.
Google Dart
The best chance of mass adoption comes from Dart. It is a mature, high-performance language pragmatically designed from the ground up to address Google’s own web development. The Chrome browser represents ⅓ of users so client-support is assured.
AngularDart with all transpiled languages, browser adoption is an immaterial gauge of success, the fair measure lies in developer adoption. On this front, the popular AngularJS web framework has quietly been supplanted by its Dart port, Angular.Dart. As developers are promised newer features and increased productivity only available in the Dart stream the impedance to switch is reversed. Attesting to Dart’s prime-time status, Google’s Lars Bak addressed the 2013 Devoxx conference with the Shaping the Future of Web Development – Dart 1.0 keynote.
Also making the leap to Dart as its premier language is Google Polymer library, the supporting library for the rapidly developing, landscape changing, Web Components standard.
Scala-to-JavaScript
While efforts into the emscripten JavaScript transpiler allow all LLVM languages (which includes Java and Scala) to compile to JavaScript, there are two projects specifically designed to bring Scala to the browser. While both aren’t yet production ready like Dart, they offer a promising glimpse to a more diverse future.
- Scala.js compiles Scala code to JavaScript, allowing you to write your Web application entirely in Scala.
- JScala Scala macro that produces JavaScript from Scala code.
Although no alternative has reached critical mass, the game is still early, and the future platform for web development is ripe for change. HTML5 and WebGL have raised the complexity of the modern web page to the point where the development environment is now a limiting factor. The single language option is having a meaningful effect on future web development. JavaScript may represent 95% of the web today, but it would be naïve to expect that not to change.