19
gvnix
6y

Just completed Object oriented JavaScript course and I have to say, the creaters of JS must have smoked some good shit before they the came up with this clusterfuck.

Comments
  • 5
    Its just a different way of doing things. After a while one does not notice it anymore albeit it is a tad harder to do in in a c#/java way.

    Typescript has come a long way with this though
  • 6
    @AleCx04 It felt really clumsy.

    Looks like they tried the functional programming way & gave up in the end.

    "Sir! People still want classes!"
    "FUCK IT, give them classes. and everything java has"
  • 4
    @gvnix it was actually supposed to be Scheme(a Lisp language. And one of the main 2 dialects the other being the Common Lisp type) for the browser. The project was supposed to make Scheme the true language of the browser and mind you these languages are functional(but not purely functional like Haskell)

    In the end they decided to change it to a different syntax type that was more common to the majority of languages, hence the curly brackets and the semicolons and stuff.

    Legit I have not checked why they went with prototype based object system. Not many languages implement this, the other one I can think that has it is Lua, but Lua is a better designed language with more sane defaults.

    It does feel clumsy at first. To some it never goes away and the lang does have a fuckload of quirks. Even with the current iteration of the language supporting "classes" it is merely syntax sugar over its prototype based system.

    I still like it a lot tho.
  • 3
    @AleCx04 maybe I will like it too.

    But for now it's painful.
  • 0
    @gvnix i feel you man. We'll see how it goes! Have fun!
  • 3
    OOP JS? Yeah, fuck that. I'm trying to stop using ctor functions and class because that's just syntactic sugar over the prototype stuff. I'd rather have plain objects and explicit prototypes. I think JS should stop pretending to be object oriented, it's really confusing.

    edit: oops, I'm just parroting what @AleCx04 said. Hello, fellow JS enthusiast 😍
  • 1
  • 0
    I never seriously used JavaScript and actually only looked up prototype-based type systems (especially JavaScript's) because of this post and (I never thought I'd say this, couldn't stand it whenever I had to use it) it does make perfect sense

    You just have to realize that you're inhering from objects, not classes

    EDIT: the site that helped me understand https://javascript.info/prototype-i...
  • 0
    @Krokoklemme its not like I didn't understand it, the thing i dont get is why the fuck they moved on to class, extends etc ?
  • 1
    In defense of the entire weed smoking community, we didn't come up with this shit.

    Ask the crackheads. Maybe they did it.
  • 0
    @gvnix They didn't move to classes. Classes and Extends are synthentic sugar for Prototypes and Inherits. They do almost the exact same thing.
  • 0
    @ilikeshred Arrays in Javascript start from 0. I don't know what you're smoking.
  • 1
    @gvnix because most people are either too stupid or to ignorant to look up how prototypes work and will then just start screaming for classes

    Basically it happened the way you described it: the community asked for it, so added it. Kinda stupid, but I understand why they added it
Add Comment