Chapter 2: Building Abstraction with Data Flashcards
What is data abstraction?
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
Object Oriented Programming: what is an object oriented programming?
a method for organizing programs in a way that:
- Classes create abstraction barriers between the use and implementation of data
- Objects respond to behavioral requests
- 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
What is an object?
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
What is a class?
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
What is an attribute of an object?
a name-value pair accessible via dot notation
what is an instance attribute?
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