JavaScript: The Lingua Franca of the Web

“I might be mistaken, but it seems like Microsoft is inventing new standards upon already existing standards.”

You are, mistaken that is. Microsoft helped establish the standard. Crockford talks about the history of javascript in his videos. Sometimes MS changed Javascript for the better, sometimes for the worse. It’s by no means a perfect language. But your choices back in the 90’s if you wanted to write a web application that was more than just POSTing to .cgi scripts were VBScript, if you only cared about IE clients, or Javascript. Which is really what I meant in my comment at Udels site. Javascript, the language, back in the 90’s was u-g-l-y. But it was available client side in almost all browsers. It meant the difference between your user clicking submit and taking 3-5 seconds to find out that they entered something on their 25 field form wrong and validating your form fields client side and not making the user wait around.

HTML (XHTML) etc is a markup language for static pages

JavaScript is a hack to make the pages dynamic Ajax is a set of hacks built on Javascript to make it work “properly” … sometimes

Flash etc… are plugins to do what Javascript cannot do or cannot do reliably

What we really need is something to replace it and give us a platform that works not a set of hacks built on static pages …

Jaster

As languages go, I love JavaScript. Simply love it. Having been programming mostly in C++ for 10 years I could never stand Java (too verbose and too restrictive and poor on features).

Libraries, however, are completely different story. Libraries are the main reason I am trying to stay away from C++ these days. And lack of any decent run-time libraries, built into browsers is why JavaScript by default looks quite weak. In fact, Flex and Silverlight can be looked at as nothing more but powerful JavaScript runtime libraries.

So it’s really not about the language, “it’s the runtime stupid”! :slight_smile:

Kudos for this post Jeff, it is nice to see someone of your stature in the blogging world champion Javascript for a change! Lots of purest programmers are quick to knock Javascript and the development efforts behind it, while pragmatic programmers have been happily using it for years and years to make things work, and will continue to do so.

I agree with Haacked. In the MS world, Javascript has (up until now) been pushed totally aside. Look at their documentation for Javascript (and the DOM). It’s total urine compared to the documentation of .NET languages. Not to mention the debugging and error reporting in IE/Visual Studio. It’s as though they were pretending that JS didn’t exist all this time and that maybe, just maybe VBScript is going to be the language everybody uses on the Web.

Javascript is awesome.
Running various random scripts on your local machine without your knowledge is silly.

Javascript created and continues this idea and expectation, so now it’s difficult even to view many pages with out running a purposeless script.

Dave Markle: JavaScript isn’t so much ignored by ASP.NET as it is hidden. A lot of the ASP.NET controls have JavaScript in them to handle client side behavior, and ASP.NET AJAX uses it in addition.

What this means is that you cna get quite a lot done without writing actually writing any javascript, which is probably why I still suck at it. It doesn’t mean it isn’t being used, though.

I recently discovered the wonder (and heartache) of working with JavaScript. I am simply amazed at all it can do…JQuery has to be one of my favorites.

Javascript is a fine language. But a language alone does not a platform make.

Unfortunately, Javascript is usually paired with HTML. HTML is a confused Frankenstein environment that has suffered at the hands of history, committee and browser. It has a complex and largely unhelpful display model. FWIW, AJAX is just the latest in a long list of hacks for beating just a little more out of this dead horse. Perversely, the limitations of HTML have propelled Javascript’s importance.

What does this mean for the future? Well, bad designed never stopped anything from becoming ubiquitous (e.g. XML). The sheer inertia of the of web will ensure a long life for Javascript and HTML. But, the web is also an eyeball arms race. And in that race, providing a superior user experience (not just visually appealing mind you) is a winning play, particularly in a world of 25 of everything.

That is why I am somewhat upbeat on tools like Silverlight and even JavaFX.

I was just about to excoriate JS at the feet of self-modifying code (html markup, in this case), but Grant beat me to it. JS isn’t really the problem; keeping track of exec and innerHTML and innerText (and so on), is.

Why is everyone saying “The problem with JS is X” and “The problem with HTML in Y”. What you’re really finding are reasons for some undefined “bad concept” about JS or HTML-- it doesn’t feel as nice or elegant or as powerful to programmers experienced with other systems. But take a frank look at the facts: every single computer out there has a browser with JS and DOM support (to one degree or another). Anyone can download a web page and view it. All you need to develop for this “platform” is Notepad and a browser. All other tools are truly optional. This is a big deal, there’s really no other language/platform like that today. And I think this is the reason Jeff made this post.

Silverlight 1.0 is of course implemented in… Javascript. :slight_smile:

Also I have to agree with the NoScript boosters. I don’t mind allowing sites to use Javascript after I see them and choose to allow it, but by default it’s going to stay off.

I very happily ignored JS for a long time.

Then recently I started on a project which uses Google Maps as part of the interface and had no choice but to learn at least some JS. It wasn’t nearly as bad as I’d imagined.

JS had a well-deserved bad reputation for providing nothing much of value to the end user, but that isn’t the language’s fault; the blame lies with the people who abused it, and the Netscape/IE wars which crippled it’s cross-browser compatibility for years.

The better executed “AJAX” applications have given it back some of its dignity and shown that it can, in fact, be put to good use in the right hands.

The major problems I have with it now are the tendency to have HUGE amounts of really badly written client-side code, sites which don’t have any sort of graceful fall-back for users who don’t have JS enabled, and the whole new breed of security problems we’re going to encounter. But they’re issues shared by any client-side solution.

Products like Adobe Flash/Flex have never tried to be like or replace Javascript. Javascript has always had it’s place and “multi-media” plugins like Flash have had their place.

To compare them doesn’t really make sense. You think Macromedia all those years was trying to compete against JavaScript? Haha silly rabbit no.

The only reason they are even remotely being compared now is because the rise of Ajax and hence the rebirth of JavaScript. JavaScript is just a language and Ajax is a technque or way of doing something. ActionScript is a language…and Flash is a yet another way of doing something. And yes, Actionscript is a sister language to Javascript because they are both ECMA script based.

Technologies like Flash still have their place in my opinion but re-thinking whether ajax could be better used is now a question I ask regularly. Although when the requirements are more multi-media, game like or experimental Flash can be used here or whatever current plugin is widely used and supported at the time.

Thanks,

-Ralph

Amen brother. We’ve taken hypertext and built a massive environment on top of it. The foundation is quicksand. I can’t avoid it, but I hate the myriad kludginess of web development. We all talk about good design, elegant code, etc… and ignore the 500 pound gorilla.

Although I’ve obviously heard of every gotta-try-this-JS-package out there, I have no interest in forcing users to opt in.

WRT the earlier comment on Rico, I went back and glanced at their homepage: openrico.org - if they can’t even get that simple page to validate, why in the hell would I want to subscribe to their code?

Not to pick on them, I have a feeling they’re not the only ones out there…

btw: I wish Crockford would setup a feed on his site. Is he still stuck in the 90’s? j/k

Let’s not forget about the other mode of Javascript avoidance - the server-side abstraction layer. GWT in JavaLand, Script# in DotNetsVille.

Interesting post, and I agree with your general premise. But you’ve got it completely wrong when you list Flash Flex as JS “alternatives”. The fact is that Flash Player is, in no small part, a JS runtime. JS is THE programming language for Flash and Flex, specifically v3 ECMAScript. In fact, not only is JS “the world’s most ubiquitous computing runtime”, Flash Player is the world’s most ubiquitous ECMAScript implementation.

Furthermore, Flash Player is more ECMAScript v3 standard compliant than any browser implementation - most browsers are based on v2 of the spec. Mozilla and Adobe are working together on Tamarin runtime, which will implement v4 of the spec. So we’re way out front in that respect too.

The only real problem with JavaScript, now that it’s finally getting the attention it deserves, is that it can make you lazy. Trust me, I know. For nearly five years, I almost exclusively used this language for all of my professional needs: on the browser side, on the server-side (as an ASP programmer) and for managing various Windows tasks and HTML applications. And I’m not even mentioning the Rhino runtime. Laziness may be a virtue, but too much of a good thing makes it bad in a way. For a long time, I never did serious programming in better respected technologies. Even though I strived to apply good development practices in my work, which I believe is more significant than large lists of acronyms to weed out bad developers, I couldn’t help but feel almost mediocre when compared to my peers.

It’s strange to see the world now embarking on a path I recently was in a hurry to leave mostly because its market value was starting to verge on the shockingly low. I don’t know if I would repeat the experience. I mean, I believe in the potential of XUL (a productive way to write run-anywhere applications that can work together), jQuery (it makes everything so ridiculously simple!), the ECMA standard (which is being adopted by various applications) and, the way the language is evolving, all we would need for it to conquer the server-side is a good developer community. – but who wants to be labeled as a JavaScript programmer?

The lure of JavaScript is so great now that, like PHP, HTML and CSS, JavaScript is becoming a kid’s language. As professional programmers are now slipping towards the lower end of the middle class, it’s those with the most wide-spread skills that will consider moving out from a profession they enjoy to cultivate – that is, unless they’re able and willing to hype themselves up to superstar status. In other words, JavaScript may well be a must, but it’s better to bet a business plan than a career on it.

according to Securityspace.com, market penetration of JavaScript is below 60%, hardly ubiquitous:
http://www.securityspace.com/s_survey/data/man.200704/techpen.html

Since it is impossible to write JavaScript that cannot be hijacked I see no pressing need to use JavaScript regardless of a market penetration of 60%. Instead I remain a member of the “The Point and Click Preservation Society”:
http://www.propylon.com/news/ctoarticles/031223_pointclick.html