Echo JS 0.11.0

<~>
nimgrg 3813 days ago. link 2 points
Are classes really a necessity for Javascript? It seems to work fine without it.

Replies

chris-l 3812 days ago. link 2 points
Agree. The prototype paradigm is really powerful, but a lot of people feel lazy to learn it, and to learn how JavaScript actually works.

When ES6 comes out, people will finally get syntactic sugar classes included by default.
But, ES6 will still be a prototype-based language (yay!), its just that it will have the class keyword integrated.

Now, I'm not saying that syntactic sugar is bad at all.

Oh no, not at all; I'm pretty excited about arrow functions myself.

Is just that, even coding with ES6, I'm gonna still be trying to use `Object.create()` over classes and `new`, when possible ;)
mostafa-samir 3812 days ago. link 1 point
If you think of JavaScript as just a front-end scripting language, then you're somehow right. But JavaScript is more than a front-end scripting language now. With the introduction of Node.js and other JavaScript environments (like PhoneGap for mobile apps, and TideSDK for desktop apps), the way is open before JavaScript to enter the realm of complex software systems, and in my observation: JavaScript's prototypal oop syntax doesn't fit in this realm. I guess there're a lot of developers that share the same observation with me by the evidence of wide usage of Coffescript and Typescript that provides a syntactic "class" sugar and compiles to JavaScript.

Note that I said at the beginning that you're "somehow" right regarding the un-necessity of classes in front-end JavaScript, that's because that the introduction of HTML5 and its new APIs that interacts with the filesystem and DBs and so, the way became open for moderately complex applications that run in the browser. The same observation holds in this situation by the same evidences, in addition to that the ES6 standards includes that syntactic "class" sugar as it's widely believed that its easier in development than prototypal syntax.