Hacker News new | ask | show | jobs
by nuclearsandwich 5464 days ago
thanks Jeremy, do you mind if I insert your comment in the main body of my post?

I am still a student of computer science and in my university's Java encapsulated worldview they've not discussed the finer points of non class-based OOP. I will do more research on the subject.

1 comments

Go for it. In a nutshell:

An object is a unit of code and data that can be treated as a distinct entity. Classes and prototypes are both way to make objects. With a prototype, you start with an actual object as an example, and make more objects just like it. With a class, you start with the abstract set of properties that describe a type of object, and make more objects from that blueprint.

Think of it as the Platonic ideal of a thing (the class), versus the canonical example of a thing (the prototype).

To get specific: The idea of Bicycle, versus my blue bike with red streamers. Both can be used to make more bikes, in JavaScript.

    newBike = new Bicycle
    newBike = Object.create(myBlueBike)
Awesome. Thanks for that. I've always enjoyed the link between Platonic forms and object Classes.

ahhhphilosophy.jpg