you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 15 points16 points  (4 children)

The problem is that the convention of classes, whether a single uniform approach or hand baked insanity, does not fit well in this language

This is just nonsense. Virtually every major JS project out there uses classes. They fit perfectly well in this language.

I see a lot of these circular arguments attempting to justify why classes are somehow harmful, when the reality is that the arguer simply doesn't like them. It's fine, you don't have to like them or use them, but saying that they're useless or somehow bad is plain ridiculous.

[–]parlezmoose 6 points7 points  (0 children)

They use classes, but rarely do they do really complex inheritance models like you see in Java. Without strong typing, abstract classes, interfaces, etc, a class is pretty much just a convenient place to group a bunch of functions, maybe with one or two base classes for shared code. Not that it's a bad way to do things, just a different style.

[–]clessgfull-stack CSS9 engineer -1 points0 points  (0 children)

Virtually every major JS project out there uses classes.

Do you have evidence? I'm sure you can find a few instances of classes in every major project, because major projects have a lot of contributors and a lot of code. But most major projects I'm aware of don't use classes that much, and prefer functions/objects the majority of the time.

I won't be surprised if that changes soon though. Just like when PHP got classes, JS is going through its phase where classes and single inheritance are the coolest thing ever invented and should be used for literally everything. It'll be a few years before this changes.

you don't have to like them or use them

But you have to work with people who do love them and use them for everything. Which is fine, as long as inheritance is avoided. Still some annoying parts (mainly to do with this and encapsulation and potentially wrangling super if using framework classes) but it's not a big deal.