OOP Flashcards
What is Encapsulation?
The process of storing functions (methods) with their associated data (properties) in on thing (object).
Why use Encapsulation?
Makes it easier to add new functionality (properties/methods).
Makes it easier to read through what was already coded.
Made it so you were not afraid to make changes.
What is Abstraction?
Hiding the details, and just showing what is essential.
Why use Abstraction?
Allows for smaller more manageable pieces of code.
Helps you to split the complexity of your software project into manageable parts.
What is Inheritance?
Make a class from another class for a hierarchy of classes that share a set of properties and methods.
Why use Inheritance?
Eliminates a lot of redundant code. (keep code DRY).
Easier to change/add/remove functionality (properties and methods).
Easier to read/keep track of what’s going on.
What is Polymorphism?
Code written to use an interface (property/method) automatically knows how to work with any number of different objects that provide the interface (property/method).
Why use Polymorphism?
Provides a way to perform a single action in different forms.
Provides an ability to call the same method on different JavaScript objects.
Also, makes your code more reusable.