Topic 1 - Classes, Objects, and Methods Flashcards
class
a blueprint or template that defines the data attributes and methods for a particular type of object
object
an instance of a class, created from the class blueprint with its own set of data attributes and methods
methods
functions defined within a class that operate on the object’s data attributes
__init__() method
a special method that is automatically called when an object is created, used to initialize the object’s data attributes
self parameter
refers to the current object instance and is used to access the object’s data attributes and methods
procedural programming
focuses on the procedures or actions that take place in a program, with procedures (functions) and data separated
object-oriented programming
focuses on creating objects that contain both data (attributes) and procedures (methods)
encapsulation
hides the internal representation of an object from the outside, controlling access to the object’s attributes through methods
abstraction
hides unnecessary details from users, allowing the implementation of more complex logic without the need to understand the hidden details
object reusability
objects can be reused in other projects, speeding up development
maintainability
code is modular, and bugs can be discovered and fixed more easily
extensibility
new objects can be added with minimum impact to existing objects
accessor (getter) methods
provide a safe way to retrieve attribute values
mutator (setter) methods
control how attribute values are modified