2

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?

vvvvv
  • 25,404
  • 19
  • 49
  • 81
xdevel2000
  • 20,780
  • 41
  • 129
  • 196

7 Answers7

3

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.

Community
  • 1
  • 1
Ash
  • 60,973
  • 31
  • 151
  • 169
  • 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 – Ali Feb 25 '09 at 17:11
  • "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 Feb 25 '09 at 17:52
  • "A beautiful, elegant, lightweight and highly expressive language lies buried under a steaming pile of good intentions and blunders" – Chris S Mar 05 '09 at 09:27
2

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
  • 164,997
  • 36
  • 182
  • 240
  • 1
    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 Sep 14 '09 at 21:14
  • @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 Sep 15 '09 at 11:12
2

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.

1

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
  • 37,540
  • 12
  • 78
  • 101
1

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
  • 1,278
  • 2
  • 13
  • 20
  • 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 Feb 25 '09 at 18:06
1

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
  • 225
  • 1
  • 10
0

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
  • 30,869
  • 25
  • 117
  • 173