Echo JS 0.11.0

<~>
MaxArt 2671 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.

Replies