Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Why? What's wrong with OOP? There is not a single way of doing things in programming.
-
cowsay2787yClasses in js are just sugar that might confuse people by making them believe that it works like it does in Java. If you need private fields you could simply use factories. They should instead add FP-like features, such as pattern matching.
https://github.com/tc39/...
https://github.com/tc39/... -
No. I want all the languages to act like the languages I know. I hate learning.
-
cowsay2787yHaving classes doesn't mean that it'll act like a "blueprint", but it will make unacquainted devs think it does.
-
cowsay2787yAn uneducated dev is not the problem, people are always learning. Classes despite being convenient only make the language more confusing.
-
@itsdaniel0 *insert joke about the American public school system*
@renanpvaz why is that such a problem? I mean everything in programming is just sugar on 1s and 0s anyway. OO JS isn't the issue. The issue is that people like the familiar. Even if it doesn't work the same as the thing they like, if it looks like the thing they like they get their foot in the door. And then: market share. -
@renanpvaz Well I, for one, find them very useful. Especially for containing variables within their scope
Even something as basic as a navigation. It can be it's own class with a method of open() and close() with a flag of isOpen
Otherwise you would need openNav() and closeNav() functions, which can clutter up a file quite easily -
cowsay2787y@projektaquarius so I guess we agree that it's problematic.
I just think that people should really learn what `this`, `new` and prototypes work like in javascript and classes get in the way of that. -
Crazed20367y@ocalderon Javascript classes aren't real classes, they're pseudoclasses that use javascritps prototype chain to mimic classical inheritance. Really all thats happening is the prototype of one object is being delegated to another, but this leads tp unexpected results and bugs in some cases. Its messy just to try to copy a design pattern when it isn't actually supported by the language :/
-
@renanpvaz oh it definitely is a problem. I just think we disagree on the magnitude of the problem. Though there is an entire stack based on JS so really nothing surprises me about JS now.
-
ac123511437yAnd OOP has nothing to do with classes!
Self is probably one of the most oo languages and doesn't even feature them at all.
JavaScript classes don't need private fields. JavaScript doesn't even need classes.
STOP TRYING TO TURN JAVASCRIPT INTO JAVA.
undefined
javascript