objects Flashcards
What are the two methods of programming that is in use today? Which one was the earliest?
Object oriented programming
Procedural programming. The procedural.
What is procedural programming focused on?
on creating functions/procedurals
What is object oriented programming centered on?
on creating objects.
What is an object?
A software entity that contains both data and procedures.
data attributes. What does it do?
Data contained in the object is known as data attributes. It references data
Methods. They perform operations on?
The procedure that object performs on. On data attributes.
What problem does OOP address.
Code and data separtaion.
How does it address the problem?
through encapsulation and data hiding.
What is encapsulation?
The process of combining the data and code into a single object.
What is data hiding?
It is the object’s ability to hide the data attributes from code outside the object.
Who may access data attributes?
ONLY the object’s methods may directly access and makes changes to the data attributes
Why is an object’s internal data usually hidden from outside the code.
data attributes are protected from accidental corruption.
OOP encourages?
Code reusability.
In order words data attributes in an object are ?
private.
What are public methods?
The methods that can be accessed by entities outside the object
What is a class?
A class is a code that specifies data attributes and methods for a particular type of object.
To create a class what do you do?
write a class definition
Define class definition
A set of statements that define a class’ method and data attributes.
the __init__ method aka?
initializer method as it initializes the object’s data attributes.
how to hide data?
self.__hide