CHAPTER 5

image

On OOP Principles

Here we take another break from coding to look at the principles of OOP in theory. JavaScript supports most of them very nicely.

According to the principles of object-oriented programming, all OOP languages have three traits in common: encapsulation, polymorphism, and inheritance.

—Subhasis Nayak

This declaration is typical in discussion of OOP’s main principles or concepts. Encapsulation, polymorphism, and inheritance have been cited as the “big three” as commonly as any. In Wikipedia’s excellent article on OOP, one section is devoted to the foolishness of picking any three characteristics of OOP in this manner (and ...

Get JavaScript Object Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.