Object-Oriented JavaScript – Part II (encapsulation)
Oct 6 2009
To carry on our tutorial on object oriented JavaScript, as our next step will be on encapsulation.
What is encapsulation? Gary Booch defined encapsulation as “the process of compartmentalizing the elements of an abstraction that constitute its structure and behavior; encapsulation serves to separate the contractual interface of an abstraction and its implementation.” Sounds smart eh?
So let’s dummy it down for this example. I’m sure you noticed, and I hope you asked yourself, in our previous examples, what if someone used a method that was being used with one object with another, well that methods scope would be over written by the new one. To ensure that each object can have it’s own method, we would have to write the method in the scope of the object. Did you “whuh?” there again? Maybe a code example will help. Read more »








![Validate my RSS feed [Valid RSS]](http://www.unemployeddeveloper.com/wp-content/themes/ud2/images/valid-rss.png)