Echo JS 0.11.0


MaxArt 717 days ago. link 1 point
Hm... no.
It's pretty clear that the strongest point of JavaScript isn't being an OO language, but still... classes in JavaScript have always been there and this hasn't prevented us creating excellent things with JavaScript.

Rather than avoiding classes at all costs, it's better to find a way to use them properly. For example, I think React's usage of classes makes perfect sense (although some purists push for stateless components and thus can be represented by the sole render function). Not to mention, in some cases we're actually forced to use classes (when defining custom elements, for example).

I've always found the argument "`class` is syntactic sugar that confuses us" pretty weak. Yes, `class` still yields prototypal inheritance. Yes, there are some quirks behind. But, as professionals, we're to learn all of this and take advantage of it. It's not like we can't call functions like that because they're first class objects while in Java they aren't. JavaScript classes are different, so what?

Moreover, we're not done with syntax in JavaScript: more things are yet to come, and they'll be about classes too. Creation and composition of classes. This means things might change in the near future.

In conclusion, while I share the sentiment that, nowadays, in everyday coding in JavaScript you probably shouldn't define classes (except for React or similar), I refuse any dogmatic approach when it comes to getting things done. Let's keep an open mind about it.
amitport 717 days ago. link -1 point
As someone who is regularly introducing javascript to other programmers. I got the say that since ES6, prototypes are no longer a core concept that is practically needed to get you started and this does wonders to the learning curve. Really people just get into the language and code base *a lot* faster, and no, they don't encounter side-effects for not knowing prototypes. That's because our code is mostly sane and prototypes are used scarcely (which should be the case for most projects).

Don't get me wrong, it will be a good thing that programmers *eventually* understand prototypes, but it really shouldn't be a core concept blocking use of the simple inheritance paradigm.