Chapter 2. Diving into OOP Principles
In the previous chapter, we introduced objects and their basic use in JavaScript. We have seen that objects have a key role in the language, but many developers consider JavaScript's approach to object management simple compared with the object management of Java, C#, and other OOP languages.
In fact, a common misunderstanding concerns the Object-Oriented nature of JavaScript. Many developers do not consider JavaScript as a true Object-Oriented language, but just a language with an outlandish use of objects.
In this chapter, we will discuss the OOP nature of JavaScript by showing that it complies with the OOP principles. It also will explain the main differences with classical OOP. The following topics will be addressed in the chapter:
- What are the principles of the OOP paradigm?
- Support of abstraction and modeling
- How JavaScript implements Aggregation, Association, and Composition
- The Encapsulation principle in JavaScript...