OOP Flashcards
What are objects?
Objects are a collections of variable and functions
What are variable presents in object called?
Properties
What are function present in an object called?
Methods
What is OOP?
Object Oriented Programming is a set of rules to structure our code so that it makes it easy to
- add new stuff and make changes
- read through
What is encapsulation?
The process of storing functions (methods) with their associated data (properties) in one thing (object)
Why is encapsulation important?
- make code readable
- it is easy to make changes
What is abstraction?
It is all about hide details and showing the essentials
Why is abstraction important in OOP?
Because it enables us to make small more manageable pieces of code
What is it used if you want to make a lot of objects
a constructor
By changing the property (this.) to variable (let) what do we achieve?
we make sure they are not bound to the object and achieve abstraction, since they are not longer visible to the user
What is inheritance?
It a pillar of OOP, which consist of make a class from another class for a hierarchy of classes that share a set of properties and methods
When you see a property for e.g (_name) what does it mean?
It is a convention that means to not to change that property
Why is it important to have “private property” that can’t be changed outside the class?
It is the mechanism that allow us to keep abstraction in our code. (remove the possibility of shooting yourself in the foot)
this._name plus a get name() method what does allow us to achieve?
Why is inheritance important?
Because it helps us to eliminate redundant code and keep our code DRY