In this article, I first want to define a few simple things.

What Exactly is Object Oriented Programming (OOP)?

According to Oracle.com,

“Object-oriented programming is a method of programming based on a hierarchy of classes, and well-defined and cooperating objects.”

In my understanding, OOP is a programming method that organizes code into objects as opposed to actions. In OOP, what we really care about is defining all of the necessary objects in our program and figuring how these objects interact with and relate to one another. OOP is an invaluable method for keeping code well-organized and well-defined.

What are objects?

Think of an object in programming like you would think of an object in real life. For instance, a person, a table, a bird, and a basketball are all examples of real life objects.

Now what exactly makes these things objects? First, each object possesses a certain set of characteristics that make it what it is (A person has a name, a face, an address, etc.). In programming, we call these characteristics properties. Secondly, each object also has a set of actions that it can perform (A person can talk, jump, swim, run, etc.). In programming lingo, we call these actions methods.

Although there is much more to learn about objects in programming, an object can basically be thought of as a distinct thing, defined by certain properties and able to perform certain methods, that can be utilized and manipulated throughout a program.

Given the name of object-oriented programming, objects are the first thing you think about in designing a program. They’re the basic units of code that help organize your thinking.

Moving on from objects, let’s define another important term.

What are classes?

Think of a class as a blueprint or set of instructions. Each class contains the instructions for building a specific type of object. Just like a real life object is built using a set of instructions, a programming object is built from a specific class. To use more programming lingo, we call an object an instance of a specific class.

Like a set of instructions, a class defines the methods and variables that make up a specific object. In other words, classes define the data comprising objects.

Why are objects and classes important?

I’ll admit, objects and classes still seem like pretty abstract concepts. But, the relationship between the two lead to very interesting concepts like inheritance and subclasses, which I’ll take a look at in future posts.

But for now, take away a few simple things:

  1. Object Oriented Programming is a programming method that concerns itself with distinct objects and the relationships between objects.
  2. Two of the most important concepts in OOP are objects and classes.
  3. Objects are distinct units of code that have properties and perform methods.
  4. Classes are templates or instructions used to construct objects.