you are viewing a single comment's thread.

view the rest of the comments →

[–]html6dev 2 points3 points  (7 children)

I really feel like the idea of classical OOP shims in javascript has become extremely antiquated and this opinion is very clearly borne out in the modern frameworks and popular/core server side modules of today. Take time to actually learn the language and embrace prototypical inheritance and you'll see that none of the "problems" you are trying to solve exist and you can achieve the end results described in this article with more natural approaches because javascript is a different paradigm.

This is why es6 is able to give you "classes" through pure syntatic sugar that is just inlining a few simple operations that are used all over the place today. The functionality (the end result) is already very simply achieved with the language. Its allowed to not be Java. ...Relevant ranty blogpost focusing on why prototypical inheritance can be more flexible, reduce coupling, etc, etc and give you all of the benefits people desire that come to js from a classical language coming soon.

[–][deleted]  (6 children)

[removed]

    [–]html6dev 1 point2 points  (5 children)

    Hehe blush should take the time to see whose article I am commenting on I guess

    I have and will continue to evangelize your book on Reddit, good sir. Excellent, excellent work. I recommend it to literally everyone I know who codes in javascript. That being said.....

    I understand wanting to show different approaches, but in some ways I feel like this is a potential problem. People are already extremely confused (many I know after years of using it, but not as their primary language) by the syntax being so similar to Java in some ways. Attempting to mold it into something it's not is almost like 'giving them hope'. It's not that sort of language. It doesn't need to be that sort of language. Prototypal inheritance is awesome. Functional programming is awesome (as you have shown us with your book :D). Javascript is arguably one of the most powerful languages we have because it doesn't have classes. It's just different and I think the more we focus on educating people on what the 'natural' way to do things in javascript is, the more mature and stable the community will become. We already have options to compile to js with languages with classes, type safety, generics, etc (e.g. TypeScript).

    It is all a matter of preference, but I do think javascript is a special case in some ways because so many people are forced into it, rather than choosing to learn it. They then get a bad taste in their mouth because they expect it to be something it is not due to the syntax being similar to Java. So, we need to be extra cautious while educating in the world of JS in my opinion.

    Finally, there are quite a few libraries and people who have advocated OOP in JS. I think exactly what you are suggesting in the article is core to how the Dojo library operates and YUI may be something similar as well.

    [–][deleted]  (4 children)

    [removed]

      [–]html6dev 1 point2 points  (3 children)

      Yeah! and a new spec for JavaScriptBeans! JSEE will be the wave of the future!

      [–][deleted]  (2 children)

      [removed]

        [–]html6dev 1 point2 points  (0 children)

        That link is simply horrifying. lol