Object Oriented Programming Review
Vocabulary
Object Oriented Programming contains a lot of vocabulary and that vocabulary is crucial to your understanding of the programming paradigm. Thus, we spend a decent amount of time making sure that your fundamental understanding of the vocabulary is sound. We have 3 main words that you should be acquainted with. They are: class, objects, and methods.
Class
A class is the fundamental idea in object oriented programming. You can think of the class as a sort of blueprint for the objects that you want to create. For example, I might make a Person
class that represents a real life human being. That Person
might have an age, a height, a weight, etc. Those are what we call attributes of the object.
This blueprint of a Person
that we are creating represents and holds the instructions on how to create an object. This is called the constructor. The constructor’s job is to create an object or an instance of the class (as they are often referred to as).
Objects
Objects are things that hold information. They are also referred to as instances of a class. What that means is that the object is created using the constructor method of the class. Once our object has been created, we can start storing and retrieving information from the contents of the object. There are two more vocabulary words that are attached to objects, they are: attributes and methods.
Attributes hold information about the object. This includes anything that you want to look up about your object. Using the example from before, we have our Person
class that has a height, weight, and age. Those are all attributes because they hold and store information about our object. They do not change when accessed and we can look them up at any time.
Methods
A method is a function that is associated with a particular class. It works either on an individual object or on a class as a whole. A method is something that either accesses information about the object or class, or it changes or mutates the information associated with that object or class. Methods are associated with the class that they are defined in.
I don't claim to be perfect so if you find an error on this page, please send me an email preferably with a link to this page so that I know what I need to fix!