Transcript from the "Prototype" Lesson
[00:01:07] And that we have to have a very different, not just a different syntax but a very different design pattern for our software, and that's where we're headed, okay. So, we're gonna first, I was gonna talk about these common OO patterns. There's a couple of slides there where I show off the Singleton pattern, the Observer pattern.
[00:01:24] They probably speak for themselves so just in the interests of time I'll probably skip over those slides, and we'll go right into our discussion of the prototype mechanism.
>> Kyle Simpson: So I'll skip over a couple of these. If there are any questions and we have some time at the end I can go back and answer any questions you may have.
[00:02:06] And I already showed you how that works. Remember, when we call new with the function, it creates an object. That's not the same thing as instantiating a class, it's just that it constructs objects. As a matter of fact I would push back on nearly two or three decades worth or precedent.
[00:02:41] That language is Lua. Those are maybe the only two languages in existence today which actually deserve the moniker object oriented, cuz they're the only languages where you can actually create an object without a class. And all the other languages are all about classes and classes getting instantiated in objects.
[00:03:21] And each time one of those constructors is called a brand new object is created. So it lends itself to you thinking that there's an instance happening, when in reality it's not actually an instance. [COUGH] It's often said that a constructor makes an object based on, that constructor's prototype, and it is that phrase, based on, that I take most objection to.
[00:04:24] So the phrase based on really leads us down the wrong path. So I would say it's more appropriate to say that a constructor makes an object that is linked to the constructor's prototype. And there are people that will say these are one and the same and I would push back and say these are fundamentally different mechanisms.
[00:04:42] Okay. So what do we mean by linked to? You might remember when I discussed the new keyword. I talked to you about those four steps and I told you there was 0.2 that it was the things that it did was that it linked to an object. And I said put an asterisk there because we're gonna come back.
[00:04:56] Now we're gonna talk about what that linkage means. What do we mean that a constructor is making an object link to some other prototype object? What does that really mean?