Hacker News new | ask | show | jobs
by rilita 4018 days ago
tldr: ( my own, not the authors in the article itself )

- Read books

- Learn libraries ( author seems to like node.js and recommends libraries associated with that )

- Do exercises

- Learn how classes work in JS ( Note this is amusing to me since JS does not have classes in the typical sense [ they are implemented via libraries with prototypes and closures ] )

- Learn what Es5, Es6, ES7 are ( There are good things here, but be aware that most of these features are not implemented in most browsers and will requires shims and/or translators to even function. Be careful as they may work in your browser but not others. Test! )

- Read JS blogs and watch JS educational videos

- Practice

It's an okay article. If you are clueless how to start learning seriously this should help. Some decent books and websites are mentioned by name.

I think the "every JS developer needs to learn XYZ" is a bit off though. This is one man's perspective.

2 comments

> Learn how classes work in JS ( Note this is amusing to me since JS does not have classes and everything about the way they are done is just craziness compared to a real OO language )

This kind of derision is typical of people who try to force prototypal inheritance to work in the same way as classical inheritance. I suggest learning the details of the prototype chain and how it works - you'll discover it is about as powerful as classical inheritance, but in different ways.

- Learn how classes work in JS ( Note this is amusing to me since JS does not have classes and everything about the way they are done is just craziness compared to a real OO language )

ES6 brings classes: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

- Learn what Es5, Es6, ES7 are ( good for confusing yourself and writing code that won't work cross-browser... )

Babel means you can write ES6 and ES7 code and make it cross browser: https://babeljs.io/

Are you kidding here? In ES6 classes provide nothing more additional than the closures already in use via a bit of extra utility code. Doubters should click the link here provided by Luke. It is filled with "To Be Determined" for all details of anything useful.

Do you know what classes actually do in a real OO language, or are you just a fanboy of JS?

Also, using shims or translators proves nothing. I can write in C++ and use translators to convert that to JS. What is the point here exactly?

Adding extra confusing junk onto a weak language does not make the language "better", especially when the standards you are recommending people to learn aren't even finalized.

Where is the Acid test for ES5, ES6, and ES7 features? Hell where is the Acid test for HTML5?

Oh that's right; all of this is just a pile of nonstandard junk that people are begging for and isn't really implemented.

> In ES6 classes provide nothing more additional than the closures already in use via a bit of extra utility code.

ES6 classes are sugar over prototypes, not closures. Insisting that ES6 classes aren't classes requires at the very least a basic understanding of how they are implemented.

> Do you know what classes actually do in a real OO language

JavaScript is a real OO language. Do you mean class-based?

> are you just a fanboy of JS?

Surprising vitriol here and makes you lose all credibility. Why does stating a couple of facts imply that you are a fanboy of JS?

> Also, using shims or translators proves nothing. I can write in C++ and use translators to convert that to JS. What is the point here exactly?

The point is that you stated that ES6 and ES7 code don't work cross-browser. Using Babel means that they do.

> Adding extra confusing junk onto a weak language does not make the language "better", especially when the standards you are recommending people to learn aren't even finalized.

Where exactly did he make this argument?

There are several, not necessarily compatible ways of defining OO:

http://paulgraham.com/reesoo.html

Have you looked at the implementations of classes in jQuery, Prototype, Mootools, Dojo, etc? I have. I've used thousands of lines of codes from these libraries and fixed numerous bugs in them. ( Note I'm referring to the 'bind' function specifically in the case of jQuery as it doesn't even provide an equivalent to Class.create(). That said, John Resig himself wrote an article about this and ported out the core of Prototype [ same as I have done ] http://ejohn.org/blog/simple-javascript-inheritance/ )

Using the prototype may be the way that things get copied from the base definition to an instance, but generally closures are what allow things to have the proper scope. Arguably the scope is far more important for using something like a class than the copying. Additionally, without closures there is no way to pass of anonymous function pointers calling back into the class.

If you think you are demonstrating that I have a lack of knowledge of how this shit works, you are mistaken. But by all means, continue disregarding my points and nitpicking details instead.

You will note that here on hacker news I don't really give a shit about my credibility; I care about providing the most accurate information I can to the benefit of others.

You haven't invalidated my statement about translators at all. ES5, ES6, etc are not cross-browser compatible. Using a translator to "make it work" doesn't count. If you wish to say that C++ is cross browser compatible too then fine, but it is obscuring the root issue that those features do not exist in all the browsers, nor even the whole set of them in any one browser. This is misinformation and will mislead developers.

My last paragraph is in reference to the fact that JS/Ecmascript have never truly been "fixed". It is just a constant hodgepodge of whatever vendors decides to add on to the language.

> Have you looked at the implementations of classes in jQuery, Prototype, Mootools, Dojo, etc?

Yes, and jQuery doesn't implement classes.

> I care about providing the most accurate information I can to the benefit of others.

By calling other people fanboys after they provided a link?

> ES5, ES6, etc are not cross-browser compatible.

I guess it depends on your definition of cross-browser compatible, but ES5 is what, 5 years old now? I guess it doesn't work on IE8, but by that definition ES3 isn't cross-browser compatible because it doesn't work on IE1.

As for ES6, it's cross-browser compatible in the same way that CoffeeScript is, with the added benefit that it'll work natively in most browsers in a few years.

> My last paragraph is in reference to the fact that JS/Ecmascript have never truly been "fixed". It is just a constant hodgepodge of whatever vendors decides to add on to the language.

That's really not the case anymore.

jQuery provides bind. That and related code is what I am referring to in that case, hence my insistence on the importance of closures. I have revised my comment to mention this as well as the fact the John Resig himself reccomends the Prototype way of doing Class.create(). By the way, Class.create() itself is implemented as a closure.

Are you claiming that CoffeeScript is cross browser compatible? If so you are just going further down the rabbit hole. To my knowledge there is not a single browser than itself is capable of parsing CoffeeScript without a helper library that doesn't come installed by default. ( Firebug comes to mind, and if I recall correctly there is a helper tool for that. I'm also aware of source mapping for debugging things such as JS in both Firebug and Chrome )

I'm using ES6 classes (and even parts of ES7) extensively in production today, and it's not nonstandard junk, and it's definitely made the language better.