Object Oriented Programming Flashcards
What is Object Oriented Programming?
Objects: Object-oriented programming is a programming paradigm based on the concept of “objects”,
Object Attributes / Properties: Object data, in the form of fields, often known as attributes
Object Methods: Functions on objects
What are disadvantages of Object Oriented Programming?
- It can be slower than functional programming.
- OOP has a steep learning curve.
- Script folders and files increase as the application scales.
What are advantages of Object Oriented Programming?
- OOP reduces the complexity of your code base.
- It helps you express your code clearly, making it more readable to others.
- Programs written in OOP are typically more scalable.
- It eases code testing and debugging.
- OOP eliminates code duplication, establishing the DRY (do not repeat yourself) principle.
- OOP code is often more modular, encouraging the separation of concerns.
- Class composition and inheritance make your code more reusable.
- Abstraction improves code-base security.
What are Classes in OOP?
A class is a collection of code presented as data performing similar actions. You can view a class as an object handler since you use one to instantiate objects.
What are Methods in OOP?
Methods define how a class achieves its tasks. A class can contain one or more methods. You can view methods as ways a class shares responsibilities within itself.
For instance, a unit converter class might contain a method for converting Celsius to Fahrenheit. And it might include another method for changing grams to ounces.
What are Attributes in OOP?
Attributes are the features—or properties—that describe a class. A unit converter class might contain attributes like the units of conversion, for instance. You can define methods that act on these attributes.
What are Objects in OOP?
Simply put, an object is the instance of a class. When you instantiate a class, the resulting object will use the class as a blueprint for its attributes and methods.
What makes a programming language object-oriented?
Encapsulation, Abstraction, Inheritance, Polymorphism
What is Abstraction?
Object-oriented programming helps you abstract your logic by presenting individual tasks as single calls.
Abstraction manages the complexity of a system by hiding internal details, composing it into several smaller systems, and highlighting an object’s essential features to the users.
The main idea of abstraction is to define real-life components in different complex data types.
What are benefits of Abstraction?
- Hides the complexity from the user
- Helps to show only the important service to the user.
What are forms of Abstraction in Javascript?
- Abstract Classes - An implementation of a concrete data structure.
- Abstract Methods - Data structure functionality implemented in methods
Abstraction - Abstract Classes: What parts of JavaScript class defines complex data structures?
- Constructor method
- Get/set accessors
- Methods
Abstraction - Abstract Classes: How do Constructor methods relate to OOP?
A constructor is a function you can use to create an instance of an object. As well as creating a new object, a constructor specifies the properties and behaviors that will belong to it.
Abstraction - Abstract Classes: How do Get/set accessors relate to OOP?
Get/Set accessors provide abilities to create computed properties based on object state or add validation for setting property values.
Abstraction - Abstract Classes: How do Methods relate to OOP?
Methods provide an interface for communication between objects and behavioral functionality that may be executed from the context of creating an object.