Putting Java in our Script, our unfortunate doom
Thursday Nov 15 2007
There is much talk and concern lately about the latest implementation proposals of JavaScript 2.0, largely based off of ECMAScript 4 which unfortunately, is starting to look a lot like the Java programming language. Despite the hoorah of bug fixes which actually, I'm in favor of, we're beginning to see Classical paradigms not only sneaking into JavaScript, but overtaking it. With language "features" (*sigh) like classic notions ofClass
definitions, interfaces
(which comes with implements
), constants, static private functions, generic functions (whatever that means), namespacing, packaging, formal extend
ing, constructor
s, and of course, the ability to strictly type your application; this is no longer JavaScript. JavaScript 2.0 is a new language that just so happens to have JavaScript support.
Why?
No, really. Why? Why bother implementing all these features that introduces another object-oriented style into a language that already has one. Having both classical and prototypal systems living in the same engine is a horrible decision, unthoughtful, and silly. Horrible because they've probably doubled the size of the interpreter (despite the optimizations they made on algorithmic operations). Unthoughtful because they're forgetting who 90% of their users are: Web Developers. Silly because they've just made it more confusing and elevated the possibilities of incompatibilities.Confused? Stand with Microsoft?
Despite an angry, but good spirited open letter from Brendan Eich (inventor of JavaScript) toward Chris Wilson of Microsoft, it seems as though the only ones who can save us from a tragic overhaul of the beautiful language is Microsoft. And from the looks of it, smaller, open-source browsers seem to be entirely on board with these language modifications. This basically leads me to want to lean on the shoulders of Microsoft (and the Internet Explorer team) and let them use the muscles they've been known to have in the past.Don't get me wrong
It's not that I'm not for the proposed ECMAScript 4 language features, it's that I'm against the adoption of those features into JavaScript 2.0. It's at that point where it's simply not JavaScript. Besides, most object-oriented idioms already have a way of being applied to the JavaScript language without introducing these so-called features. JavaScript (as it stands) is a supremely lightweight, expressive language that allows us to apply classic design patterns that most didn't think were even possible. As a brief segue (and not to distract from the original intention of this post), if you are so inclined to know more about these patterns, buy my book JavaScript Design Patterns and see for yourself that the current state of JavaScript is completely capable of implementing factorys, singletons, adapters, bridges, composites, private and privileged methods, multi-inheritance, chains, observers, commands, flyweights, decorators, proxys, namespaces, and much much more.So now what?
As one fellow Engineer at Google put it, "... in ten years, if and when this stuff finally gets fully supported across major browsers, I hope to be retired by then and won't have to worry about it." I wish that were true for me. And although it might not seem like a big deal now, for the very reason that it won't be for ages until this is usable, this is the future of the web and web applications. Woe will be the day when a new generation Frontend Engineer walks up to you and says "What's a prototype
?" Then you'll know you're old-school. In the meantime, if you have something to say, say it now. Just keep my name out of your open letters ;)
recent
- Matador: The Obvious MVC Framework for Node
- Sandboxing JavaScript
- Crouching Ender, hidden command
- Ender.js - The open submodule library
- Qwery - The Tiny Selector Engine
- Klass
- Smallest DOMReady code, ever.
- $script.js - Another JavaScript loader
- About that slowness on Twitter...
- Autocomplete Fuzzy Matching
- JavaScript Cache Provider
- JavaScript Animate
- Asynchronous method queue chaining in JavaScript
- Something changed
- Unofficial Twitter Widget Documentation