1/28
Vocabulary flashcards covering core object-oriented programming concepts and Python definitions from the CS 1110 Prelim 2 review notes.
Abstraction
Making a complex class act like a familiar type using methods or operator overloading.
Accumulator
A variable updated in a loop that stores computed information for use afterward.
Attribute
A variable stored in an object (instance attribute) or belonging to a class (class attribute).
Bottom-Up Rule
Python searches the object, then its class, then parent classes until it finds an attribute or method.
Class
A user-defined type whose values are objects.
Class Definition
A blueprint specifying the attributes and methods shared by objects of a class.
Constructor
A call like RGB(255,0,255) that creates an object, executes init, and returns the object reference.
Default Argument
A parameter's fallback value if omitted; specified as y=2 in the function header.
Encapsulation
Hiding data and implementation details, often using hidden attributes, getters, and setters.
Getter
A method that returns a hidden instance attribute without allowing direct modification.
Global Space
Memory for variables defined outside functions; they persist until removed or Python exits.
The Heap
Memory holding objects, class folders, function definitions, and imported module contents.
Immutable Attribute
A hidden attribute with a getter but no setter; users cannot modify it through the interface.
Implementation
The actual code satisfying a specification; it can change as long as the specification remains satisfied.
Inheritance
A subclass receives attributes and methods from its superclass without redefining them.
Interface
Public information needed to use code, such as function headers, specifications, and public methods.
Instance
An object created from a class; synonymous with object.
Invariant
A condition on one or more attributes that must always remain true.
is Operator
Tests whether two variables refer to the same object, not whether their contents are equal.
isinstance
isinstance(ob,C) is True if ob belongs to class C or a subclass of C.
Method
A function defined within a class; when called on an object, that object is passed as self.
Mutable Attribute
A hidden attribute with both getter and setter; changes must preserve invariants.
Object
An instance of a class, typically containing attributes and supporting methods.
Operator Overloading
Defining operator behavior for objects using special methods such as add and eq.
Overriding a Method
Redefining an inherited method in a subclass; super().method() can call the parent version.
Setter
A method that modifies a hidden attribute while enforcing its invariants or preconditions.
Subclass
A class extending another class and inheriting its attributes and methods.
Instance Attribute vs. Class Attribute
Instance attributes belong to individual objects; class attributes belong to the class.
Interface vs. Implementation
Interface tells users how to use code; implementation is the hidden code that makes it work.