tags:

views:

200

answers:

7
+2  Q: 

javascript 2.0

Hi,

I'm spending a lot of time to learn how OOP is implemented in Javascript as in ECMA 262 of 1999: now I want to know if someone think that the new JS 2.0 will arrive soon and I'am studying uselessly because with this new version will be the OOP implemented in a classical way (Java etc.) and will be interfaces, generics and other classical languages features...

So do I must stop and wait...........?????

Thanks

+1  A: 

I think there's enough existing code out there in the current Javascript version that even if some new JS version were released today, it would still be worth learning how the current version works.

Herms
+2  A: 

JavaScript 2 is dead. There'll be ECMAScript 3.1, which will feature mostly clarifications, security enhancements and library updates, and ECMAScript Harmony, the replacement for ECMAScript 4 (aka JavaScript 2). A lot of the things planned for ES4 are no longer under discussion for Harmony, though.

Christoph
For readers coming here in the future: ECMAScript 3.1 is now ECMAScript 5, and is now in final draft. http://www.ecma-international.org/publications/files/drafts/tc39-2009-025.pdf is the Spec Location. ECMAScript Harmony will probably be ES6, and JS2 will be whatever the Mozilla folks decide.
Sean McMillan
@Sean: the version you link to is out-of-data; the current one can be obtained from http://wiki.ecmascript.org/doku.php?id=es3.1:es3.1_proposal_working_draft
Christoph
A: 

Since the heavy hitters all do OOP in a similar fashion (Java, .Net, Python), I would guess than anything done would follow those similar methodologies. Since so much is done in those languages, there is a huge amount of training that has gone into cementing those processes in the collective mind, and at this point there doesn't seem to be much need to change things.

cdeszaq
+4  A: 

Javascript is a dynamically typed script language that uses prototype based inheritance.

It is exactly these attributes that differentiate it from Java, C# and make it so applicable for web development in particular. Why would anyone want or need to turn it into another Java or C#, they already do that job quite well.

So no, learning Javascript now is very worthwhile. Learning Javascript more deeply has actually helped me to better understand dynamic languages in general (coming from C#,C++) and even has some Functional aspects to get to grips with.

Ash
Being a web developer I fully disagree with you. Some of the prototyping features are nice but OO support overall sucks and more powerful OO features such as interfaces, generics, etc would make it useful. That's why I'm going to learn google web toolkit so I can use Java to write javascript
Click Upvote
"Being a web developer", then you've got a lot to learn about "real OO" design and it's benefits and drawbacks. I've done both types for the past 12 years and so feel I can see both sides of the coin. ie. Static typing, "real OO" versus dynamic typing "relaxed OO".
Ash
"A beautiful, elegant, lightweight and highly expressive language lies buried under a steaming pile of good intentions and blunders"
Chris S
+1  A: 

You should still learn how OOP works in current version of JavaScript (ECMAScript). ECMAScript 3.1 introduces a whole bunch of static Object functions, including inheritance.

Actually, you can already implement the Object.create() function in current JavaScript (code by Douglas Crockford):

if (typeof Object.create !== 'function') {
    Object.create = function (o) {
        function F() {}
        F.prototype = o;
        return new F();
    };
}

// you can now do this
newObject = Object.create(oldObject);

Word of caution though, you don't need to use OOP all the time. If OOP makes sense then use it, if not don't.

jay_soo
see here: http://mercurial.intuxication.org/hg/js-hacks/raw-file/tip/clone.js for a slightly different version which doesn' create unnecessary function objects
Christoph
+2  A: 

I would highly recommend you learn JavaScript as it is. Whatever changes may come, you'll still be forced to deal with the historic usages sooner or later, and probably very often if you are a web developer. I would also recommend Crockford's JavaScript: The Good Parts, as it covers all modes of inheritance and strips away the bad stuff you shouldn't use.

Ryan Riley
I love that book. Excellent recommendation!
EllaJo
+1  A: 

Like Christoph said, JS2.0 is dead. Like Herms said, there is enough code out there that it is Definitely worth learning the current version. And JavaScript is a very easy-to-learn, quick way to learn about the basics of OOP in any language. You are not studying uselessly, and I applaud you for studying! I would recommend that you keep going.

EllaJo