Chapter 2: Building Abstraction with Data Flashcards

1
Q

What is data abstraction?

A

data abstraction isolates how a compound data value is used from the details of how it is constructed.

the basic idea of data abstraction is to structure programs so that they operate on abstract data

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

Object Oriented Programming: what is an object oriented programming?

A

a method for organizing programs in a way that:

  1. Classes create abstraction barriers between the use and implementation of data
  2. Objects respond to behavioral requests
  3. Objects have local state that is not directly accessible from the global environment

the object system offers more than convenience. It enables a metaphor for designing programs in which several independent agents interact within the computer

each object bundles together local state and behavior in a way that abstracts the complexity of both

Objects communicate with eachother and useful results are computed as a consequence of their interaction

Objects also share behavior of objects among other objects of the same type and inherit characteristics from related types

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

What is an object?

A

an object is a data value that has methods and attributes accessible via dot notation.

every object has a type, known as its Class

an object is an instance of a class

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

What is a class?

A

we use classes to create new types of data

a class serves as a template for all objects whose type is that class

a class definition specifies that attributes and methods shared among objects of that class

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

What is an attribute of an object?

A

a name-value pair accessible via dot notation

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

what is an instance attribute?

A

an attribute specific to a particular object

for example: a program for bank accounts. Each bank account has an account holder and an account balance. The account holder and account balance are both instance attributes

instance attributes may also be referred to as fields, properties, or instance variables

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