What is OOP? Flashcards

1
Q

What is OOP?

A

It is aprogramming paradigmin which we think about a problem in terms of objects, bundles combining both state and behavior.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is Instantiation?

A

Instantiationis the process of creating a new instance object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is encapsulation?

A

encapsulation describes the idea of bundling or combining the data and the operations that work on that data into a single entity, e.g., an object. It may also refer to the limiting of direct access to some of that data, such as an object’s components.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

how do you use compact method syntax?

A

let raceCar = {
make: ‘BMW’,
fuelLevel: 0.5,
engineOn: false,

startEngine() {
raceCar.engineOn = true;
},
}

You can omit the:and thefunctionkeyword and use parentheses to denote a method.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are collaborators?

A

Objects that help provide state within another object are calledcollaborator objects, or more simply,collaborators.Collaborator objects play an important role in object-oriented design; they represent the connections between the different classes in your program
We say that two objects have a collaborator relationship if one of them is part of the state of the other.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Define a factory function for a car

A

function createCar(make, fuelLevel, engineOn) {
return {
make: make,
fuelLevel: fuelLevel,
engineOn: engineOn,

startEngine() {
  this.engineOn = true;
}, }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is factory Shorthand?

A

function createBook(title, author) {
return {
title, // same as title: title,
author, // same as author: author,

getDescription: function() {
  return `${this.title} was written by ${this.author}.`;
},   }; }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly