Before to start, it is important to talk about paradigms, they cab be considered as ways, guidelines, to approach and face the problems or solve our algorithms; the most popular known are: - Structured - Object Oriented - Functional One paradigm is not better than other, it might depends for the context and situation. Each language can work with one or more paradigms, unfortunately, certain languages cannot work with certain paradigms.
Advantages of OOP: - Order - Everything is connected - Reusable code -> Classes are known as the molds, that we use to instance each object.
Objects: They contain methods (functions) and attributes (characteristics)
Prototypes are a mechanism by which objects in JavaScript inherit features from each other, remember, despite JavaScript is a oriented object language, it is a language based on prototypes.
- Class: Representation of methods and attributes that represent an entity.
- Object: Instance of a class.
- Inheritance: Creating new classes with similar characteristics from other classes.
- Encapsulation: Hiding data that can only be accessed by the class.
- Polymorphism: An object can behave in many ways, e.g.: In inheritance, child classes can behave like their parent class and vice versa.