The Object Model Flashcards

1
Q

What does Encapsulation do?

A

Hides certain processes from the rest of the code base; so that this data cannot be affected unintentionally

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

The ability for different types of data to respond to a common interface

A

Polymorphism

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

Through ___ , programmers can define basic classes with large reusability and smaller ___ for more detailed behaviors

A

Inheritance, subclasses

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

___ are similar to classes in that they contain shared behavior

A

Modules

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

(T/F) You can create an Object with a Module

A

False; only Classes can create an Object

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

Modules must be ___ __ with a class using the __ method

A

mixed in, include

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

State refers to…

A

the data associated to an individual object

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

Behaviors are…

A

what objects are capable of doing

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

Instance variables are how we keep track of ___

A

States

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

The initialize method is what type of method?

A

Constructor method

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

Instance variable has this symbol before its name

A

At sign (@)

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

Until when does an instance variable instance exist?

A

As long as its object exists

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

We allow objects to have behaviors with

A

Instance methods

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

A getter method does what?

A

It allows you to access an instance variable

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

A setter allows you to…

A

change the data associated with an instance variable

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

The built-in Ruby way to create both the getter and setter methods

A

attr_accessor

17
Q

The built-in Ruby way to create a getter method

A

attr_reader

18
Q

The built-in Ruby way to create the getter method

A

attr_reader

19
Q

The built-in Ruby way to create the setter method

A

attr_writer

20
Q

Instead of using the instance variables directly in instance methods, use…

A

the instance getter method

21
Q

In order to specify to Ruby that you are not initializing a local variable you must…

A

precede a setter method with self