Live data from Hacker News

Show HN: Classes for javascript that you'd actually use

github.com

1–10 of 25 posts

Re: Show HN: Classes for javascript that you'd actually use

#5
It seems that everyone wants to add classes to Javascript. I understand that prototype-based programming is a bit of a change from class-based programming, but this is starting to feel like wasted energy on a problem that does not need solving.

What benefits do developers get from using a 3rd-party library to create classes in a prototype-based OOP language? Why can't developers just learn that there is more than one style of OOP, and go with the flow?

Re: Show HN: Classes for javascript that you'd actually use

#6

It seems that everyone wants to add classes to Javascript. I understand that prototype-based programming is a bit of a change from class-based programming, but this is starting to feel like wasted energy on a problem that does not need solving. What benefits do developers get from using a 3rd-party library to create classes in a prototype-based OOP language? Why can't developers just learn that there is more than one…

Because, for many things one wants to accomplish, prototype-based programming is so verbose and error-prone. Adding a simple class-based abstraction over top (which doesn't hide the prototype features) gives you the best of both worlds.

Re: Show HN: Classes for javascript that you'd actually use

#8
pjs certainly deserves props for being creative with the function passing, and variable context. I haven't seen that exact usage before.

It seems every couple weeks javascript class library named X is released, avoiding issue Y, and implementing fuctionality Z.

Using `prototype` isn't terribly far off from the class systems people keep creating, so I can pretty much assume a single class library is going to reach deep adoption anytime soon.

Re: Show HN: Classes for javascript that you'd actually use

#9
normally all you'd need is a 2 liner utility method to facilitate inheritance. For the rest you can use js as it is with it's actual language features which maybe a little verbose (my only lament so far) and prototypical based but you will begin to appreciate it in the long run. I don't like the exaggerated syntactic sugar that many libs bring in, that try to abstract and tuck away js as it is, making it pretend to be a class based language when it is not. That said, this particular lib's size and the direct problems it tries to solves are done so elegantly. It's hard to ignore the good job the author has done!

Re: Show HN: Classes for javascript that you'd actually use

#10
post #3

What are the differences between this and something like MooTools? What benefits does P.js offer? (Note: I was only introduced to MooTools today, so I have limited knowledge about it.)

Mootools does all kinds of stuff. This just allows you to create classes in a traditional way with inheritance and super afaik
Post reply on HN