-
5 Guys The Evolution Of Classes In Javascript Part 3
Now that Bob can protect his personal belongings, we have a problem with adding new capabilities. If we add capabilities through a prototype on Guy, the method will not have access to “stuff.”
Read more... -
5 Guys The Evolution Of Classes In Javascript Part 2
Bob can’t protect his stuff. While we could put some of bob’s stuff in private variables, we also want Netbeans to know Bob is an instance of Guy, so we’ll change the pattern a bit to make a proper constructor.
Read more... -
5 Guys The Evolution Of Classes In Javascript Part 1
I’m demonstrating a few patterns for creating objects in JavaScript. We often want to make objects to organize functionality, provide context for our methods, and encapsulate data. To demonstrate this, I will show five different versions of the Guy class with the same basic capabilities: store (“keep”) “stuff” and “show” stuff without sharing it. I’m using the analogy of a guy named bob to help people not familiar with object-oriented JavaScript keep their bearings.
Read more...