6 ms·
javascript was never designed to be used like a classic OOP language, that's why jquery won, it was functional which meant it didn't fight you the way the other
by PH95VuimJjqBqy 3y ago
javascript was never designed to be used like a classic OOP language, that's why jquery won, it was functional which meant it didn't fight you the way the other libraries did.
javascript is first and foremost functional no matter how hard MS and others have tried to hammer it into a more typical OOP language.
- Dylan16807 3y agoI'm not sure what you mean. You can put functions into objects, you have "this" when you call the functions, you even have prototypes. It seems to me like the language is designed to let you do OOP just fine, and the only thing that was awkward was organizing the code where you define all those functions and the constructor. So they added a sugar keyword for it.
- PH95VuimJjqBqy 3y agoright, it's awkward, so don't do that, be functional instead. jquery vs mootools/scriptaculous/etc. jquery won for a reason, it's just flat out a better experience in terms of code specifically because it uses a functional approach in its api rather than an OOP approach.
- Dylan16807 3y ago> right, it's awkward, so don't do that, be functional instead. I feel like you're just saying that because you like functional code. I'm sure that when they've added syntax to make certain functional things easier to type, you didn't respond "it's awkward, so don't do that, write it in an entirely different way instead". Regardless of what is "better", which tends to differ based on situation, there was no need for the awkwardness. Classes weren't bad to use, it was just that declaring them had some pointless busywork.
- PH95VuimJjqBqy 3y agoimplicit in my responses is an assumption that you've worked extensively with jquery so you understand the syntax and how it's functional. If you don't the only response I can have is to go learn it. This isn't about functional being better, it's about functional being more fluid to use in javascript.
- Dylan16807 3y agoI've used it a moderate amount. But I'm not here to argue about how fluid functional code is, I'm here say that OOP works fine, and making slight changes to improve that experience is good. We don't need to actively discourage OOP by making it awkward. Especially when you're not dealing with the DOM, sometimes objects work quite well. The original awkwardness does not show that javascript "was never designed to be used like a classic OOP language". Nor is it why jquery worked well. And adding these slight changes is not trying to "hammer" javascript into being "more typical OOP".
- PH95VuimJjqBqy 3y ago> And adding these slight changes is not trying to "hammer" javascript into being "more typical OOP". this is disingenuous and I'm ending it here. MS spent years trying, and initially failing, to get javascript to work in a more traditionally OOP way. describing that as slight is something else.
- Dylan16807 3y agoI started off with "I'm not sure what you mean" and you have given zero examples. I'm not being disingenuous. Other people can't read your mind. Other people aren't experts on the same things you are. And specifically, I described the class keyword as slight. Don't be an asshole by accusing people of things they're not doing.
- PH95VuimJjqBqy 3y agodo not speak with authority if you do not know. do not try and downplay something just because you want it to be true.