views:

1218

answers:

16

Perhaps I'm just unaware of the competitors, but it seems when it comes to client-side scripting in the browser and DOM, Javascript is it. I know there's VBScript, but it really isn't even in the same ballpark as JS (not even cross platform, for starters).

I'm just curious about how this came to be. Surely there would be a general desire for a new language to replace Javascript: built from scratch to do all the things Javascript has been bent and moulded into these days (look at the reliance on JS Libraries).

A: 

I think it has to do with standardization, because durring the last browser-war (ie v. netscape) there were two, Netscape's ECMA (+1 Geek point for you if you knew this was the real name for JavaScript) and Microsoft's JScript, obviously ECMA (JavaScript) won out and became the defacto standard.

Now, we have another browser-war in progress and each of the 2 (3 if you count Chrome 12% FFS) major competitors 3 fully (with a few edge-cases) support JavaScript.

Unkwntech
Where does VBScript come into that? I thought that was Microsoft's JS - or is it the same as JScript?
Ross
Surely you mean to say ECMAScript is Javascripts real name?
Ash
WTF is EMCAS? Did you mean ECMA, as in 'Ecma International', the organization which standardised Netscape's JavaScript to ECMAScript, of which both Mozilla's JavaScript and Microsoft's JScript are (mostly) conforming implementations?
Christoph
does that mean christoph gets 2 geek points?
nickf
I think Cristoph gets the "Invented the internet" badge.
Ross
@Ross: Then anyone who can read wikipedia articles should get it ;) The wikipedia article has some further information, eg that the trademark 'JavaScript' is actually owned by Sun
Christoph
Yah ECMA..., EMCAS is just another in the proverbial sea of acronyms I use everyday.
Unkwntech
I'm curious: Which one of http://acronyms.thefreedictionary.com/EMCAS would you use every day? Or is there another meaning of EMCAS?
Christoph
+1  A: 

I guess because the demand for it would have to be huge for browsers to implement it.

After all, it's the browsers that process and run the JavaScript and you'd have to have a large amount of sites using the language in order to make the browsers interested in implementing it. Then again no-one would use it if there was no browser support in the first place.

Ross
+3  A: 

There are other languages for client side scripting, but AFAIK, none are integrated into a browser.

Both Flash and Silverlight have their own Languages. Flash has ActionScript, while Silverlight has many and all that work under the DLR including Python and Ruby.

To your second point as to why, more specifically you mention reliance on JS libraries as a flaw in the language; Libraries are popular, not because the language if broken, but because the standard API is broken. The existence of such great libs builds on the power of the language.

There is nothing particularly wrong with JavaScript, it has some features that up to very recently would have been esoteric or academic. First class functions for example.

Also, ubiquity / mass existing runtime deployment is a very compelling feature. ;)

Fowl
A: 

i'd say that this is because client side web development is still a very young branch of programming. if you look at it only now it has become more widespread since we moved to faster "intertubes" :) and we're not using modems anymore.

and the problem for clent based web development is that it's not up to the developer what platform he'll use but it depends on the browser manufacturers. and they change slow.

VB script's demise was in my opinion its VB-innes. too much unnecessary stuff. As for javascript it will mature, but it's a start.

Mladen Prajdic
+3  A: 

I recommend you to view Douglas Crockford’s presentation about “The JavaScript Programming Language” to learn about the history of JavaScript.

Gumbo
+3  A: 

I think Javascript (ECMAScript) with its C like syntax is so popular for some of the reasons C is:

  • Relatively small number of language keywords (easier to learn).
  • Concise and efficient syntax (quick to write).
  • Easily extendable through external libraries and APIs that do not pollute the basic language (ie Browser DOM,FilesystemObject etc).

Creating a new language that will provide many of the current libraries "built-in" is always risky as it starts to limit future applicability of the language and makes learning the base language harder.

This would be even more problematic for a client side browser language because the language designers can't possibly know how the language may be used in the future.

I think Javascript the language is fine in its current role as the "glue" that links so many other client sode technologies.

There are no other competitors because while Javascript is not perfect, it does the job.

Ash
+26  A: 

Momentum. JavaScript has been around for 15 or so years, and browser manufacturers have worked for 15 or so years to make it work in their browsers.

If a competitor came along, it would need to really bring something new to the table in order to convince everyone to a) adopt it, b) live with locking out all the users of older browsers like IE7, Firefox 3.0, Chrome 1.0 etc. and c) find replacements for all existing libraries like jQuery, prototype, extJS etc.

In short: we don't need another Standard, let's rather improve JavaScript and build on the rich foundation that already exists instead of starting back from stone age again.

Michael Stum
If there was a replacement for JavaScript we would not need JQuery or Prototype because most of what those provide would be standard features. Those libraries exists mostly due to cross browser inconsistencies.
Bernard
@t1oracle - If that were the case, then new frameworks would be developed to make up for the missing aspects of JavaScript and the new competitor. I could expect nothing less than another point of frustration for developers. "If it ain't broke, don't fix it."
Jonathan Sampson
The issue is not really jQuery or not - the new language could just make all those features standard. The issue IMHO is that the JavaScript Train is already rolling at 200 Miles per Hour and that you basically need to have Version 1.0 of your Replacement be as complete as JS without the downsides...
Michael Stum
a significant number of the features that libraries like jquery add are effectively DOM-level, rather than pure JS (JS is a remarkably simple language -- ignoring the more "exciting" semantics), so it would not necessarily make sense to include (all of) the functionality of modern js libraries.
olliej
Point B is the major blocker.
Zach
That's what I think as well. It's just like in the CSS world where people still jump through many hoops just to support Internet Explorer 6, or before that Netscape 4.x and IE5.
Michael Stum
+6  A: 

Show me another language that isn't reliant on libraries?

C, C++, C#, VBs, ... all rely on libraries. The only difference is that they often come with a standard set of libraries.

So do we really want is a standard set of libraries? What we're currently getting is a range of library sets (JQuery, prototype, extjs, mootools, etc). This is a good thing since we the developers get to choose one that suits our needs. In addition these libraries can be included and evolved without changes to the client-side component.

I can think of no compelling language feature missing from Javascript. By compelling I mean so earth shatteringly important that I'd be willing to alienate those browsers that do not support it.

AnthonyWJones
I don't understand your point.. With any language you can include non-standard libraries, just like Javascript and jQuery/etc.. The difference between JS and C (or more comparably, Ruby, or Python) is there is a Javascript interpreter included in the browser..
dbr
That interpreter is a huge difference. JavaScript needs a standard compiled library, not a series of different scripts in different versions that must be downloaded when the user hits a new web page. JQuery, prototype, etc all add extra bandwidth and memory costs.
Bernard
@dbr: My point is in answer the questions reference to "Javascript has been bent and moulded...reliance on libraries". I was pointing out that this is not a bad thing.
AnthonyWJones
@t1oracle: It is true that downloading libraries have some cost but in real world use its minimal. As to memory usage, there so such thing as a free lunch if the browser supplied those functions natively then that would still require memory albeit perhaps maybe less memory.
AnthonyWJones
@t1oracle: Note also if the browser enhance JS to support the features of those libraries which approach should it take? Once choosen we're stuck with it. Currently if you prefer the JQuery approach you use that, if you prefer Prototype you use that and so on.
AnthonyWJones
Bernard
+4  A: 
  • Standardized (ECMA-262)
  • Common syntax and relatively simple to master
  • Good browser support
  • Extendable
  • Still being developed
  • Relatively quick based on how much data it needs to process sometimes.

If a good competitor had arrived before 1999 (ECMAScript 3), it would probably be a tie between those two.

Ólafur Waage
FYI: ECMAScript 4 is dead. There'll be ECMAScript 3.1 (mostly library/security updates and clarifications) and ECMAScript Harmony, a much less ambitious replacement for ES4...
Christoph
Ahh, nice to know. Thanks.
Ólafur Waage
+6  A: 

There is! Ones that spring to mind are Flash, ActiveX, and Java... but these all have their drawbacks.. Mainly security and integration with the browser/DOM.

Flash and Java live in their own little world, by design (and to address security issues). They can't alter the HTML around them. ActiveX has access to the DOM, but also everything else on your computer..

Javascript seems to have found a nice balance between flexibility and security, it can trivially interact and alter the pages HTML/CSS, do "safe" networking, has a decent standard library (which has things like JSON, XmlHttpRequest'sih networking, DOM manipulation and so on). Most importantly, it's available in basically all vaguely-modern browsers, on all platforms, in a consistent manner (compared to CSS)

There are problems with Javascript, but nothing major.. The biggest is the performance.. Load a comment page on digg and watch your CPU usage.. Chance are it will be 100% of one CPU core.. There are projects to improve this, like SquirrelFish, TraceMonkey and other strangely named things.. but the performance is adequate to do some extremely impressive things (Google Spreadsheet, for example).

Basically, Javascript is great, and it's drawbacks aren't nearly as big as the other competitors..

dbr
+1  A: 

Browser support. If its not an MS tech the it most likely will not go into IE. If it's not in IE then no one can use it. If it is an MS tech, then most likely only IE will have the right to use it as it will be closed source and proprietary. If only IE supports it then only some developers will use it.

To challenge JavaScript it must work just as easily and more consistently across all of the major web browsers. Without browser support any new client side web tech is destined to fail.

Bernard
A: 

My guess is that its ubiquity and ease of integration in any new user agent project. It comes built into almost all browsers so you dont have to download/install/configure anything to have it running. once you look at user agents off desktops (wii, iphone, windows mobile, n95 etc) the availability of any of the contendes dries up quick - so you code for html and javascript becuase it will work most of the time.

MikeJ
A: 

I agree with Michael, we should improve Javascript, not worry about competitors because there aren't going to be any, in fact even Javascript 2.0 seems so far from reaching reality.

Since Javascript is such an ambiguous language, we're able to create libraries (jQuery) and even abstractions (Objective-J) and not worry about all the problems that Javascript has at its heart.

Luca Matteis
What are these problems at the heart of JavaScript you speak of? The object model is a bit strange, but nothing that can't be worked around within the language. The only real problems I know of are browser incompatibilities with the DOM, but that's not a problem with the language JavaScript...
Christoph
Are you serious? http://www.slideshare.net/moschel/things-to-avoid-in-javascript-presentation
Luca Matteis
@sktrdie: the slides mention 7 issues; 2 aren't really that bad once you know about them (always use `var`, scopes are function-level), one is a library issue (`parseInt()`), one are the implicit conversion rules in comparisons (it's not a bug, it's a feature)...
Christoph
... one is caused by sloppy programmers (no parenthesis around expressions, no explicit conversion via `Number()`); imho only two are real problems: implicit insertion of `;` together with the given example of `return`, and that `typeof()` is broken; for the last one, workarounds exists
Christoph
So yes, I seriously don't think there's something inherently wrong with JavaScript. Some of the issues will be fixed in ES3.1 (there'll be a 'strict mode' which will fix some syntax quirks); that aside, I'd actually prefer using Lua or Io over JavaScript, but for me, JS is 'good enough'
Christoph
What about all the syntax problems such as the "new" keyword which can be called on functions that aren't meant to be constructors... there are many others.. but what I'm saying is that they can all be solved with frameworks etc..
Luca Matteis
@sktrdie: JavaScript is an 'unsafe' language - it allows the programmer to shoot himself in the foot; my advise: don't do it ;) If you want a safe and boring language, use Java. And btw: why is that `new` can operate on any function an issue?
Christoph
If the function isn't suppose to act as a constructor is a problem, and the other way around. "function apple(){ this.a = "apple";}" thats a constructor and if you call it without the "new" its a problem.
Luca Matteis
1. problem can be avoided by not being stupid, 2. by two lines of code; JS is an unsafe language, so use sane coding conventions: capitalize the names of constructors, use `===`, cast explicitly with `Number()`, `String()`, check the value of `this` in constructors, check arguments for `undefined`
Christoph
+6  A: 

JavaScript won because it was introduced by Netscape in the period when they had above 90% percent market share. IE and other browsers had no choice but to support it also.

If a new language should be introduced, it would have to be either by agreement between all major browser vendors, or in a period where a single browser have enough market share to push it through.

Microsoft could probably have pulled it off some years ago when IE has an extremely large market share (before the rise of Firefox and Safari), but they chose instead (for strategic reasons) to let the browser stagnate.

Today, a new language would require agreement between at least Mozilla, IE and Safari to gain traction, and I think that is highly unlikely. The browser vendors have invested a lot of ressources in optimization, compatibility testing and so on for JavaScript - why should they want to start from scratch with a totally new language - and have to support two languages in parallel for decades to come? The cost greatly outweights any benefits.

Anyway, it is quite unrealistic to believe that a new language designed from scratch could be significantly better than JavaScript.

JacquesB
MS did have VBScript back then, but that didn't exactly catch on.
derobert
A: 

View > Source

Breton
A: 

After so many years we don't even have CSS implemented same in all the browser, same goes for the JavaScript, IE has one model and rest of browsers has another Model (I mean like Event Handlers and attaching events).

If new competitor comes, it has no chance, neither it has so much time as css and javascript had.

Dmitris