Taking notes from John Morris podcast episode about object-oriented programming

I recently found John Morris’s podcast show on YouTube and have enjoyed the few episodes that I listened to. This blog post though will be focused on notes I took from his episode named: JMS239: Object-Oriented Programming – Class, Object, Property, Method. Check out the full episode if you’re interested in learning about object-oriented programming.

Notes
First, object-oriented programming is a mindset. Let’s take an example, such as a CMS (content management system).

  • The object would be posts
  • The posts would have properties such as title, date, url, id
  • The methods (things that can be done to that object) would be that it can be created, read, updated, and deleted

You can create relationships between two objects.

The post’s author would be its own object, you can then create a relationship between the post and the author.

An application:

  • Is a set of objects that has properties
  • Has certain actions that can be performed on it, or it can perform
  • Has relationships that can exist between those objects

The post is the object, the data about it is the properties, and the actions that can be done by it or to it are the methods.

A class is a blueprint for an object. An example is a house. Blueprints tell you how to build the house but it won’t give you all the specifics, such as wall color, fridge type, etc. You can create five different houses from the same blueprint (class), but all have differences, such as different flooring, colors, etc. The data that goes into the blueprint is what makes them different.

Back to the CMS example, with individual posts, each post is an instance of that object.