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 going to first, I was going to talk about these common OO patterns. There's a couple of slides there where I show off the Singleton pattern, the Observer pattern.
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.
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.
That language is Lua. Those are maybe the only two languages in existence today which actually deserve the moniker object oriented, because 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.
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. 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.
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.
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 going to come back.
Now we're going to 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?