Locked learning resources

You must own this product to watch this lesson.

Locked learning resources

You must own this product to watch this lesson.

What is Object-Oriented Programming (OOP)?

This is the first of five short video lessons that offer a different perspective on introducing OOP.

These lessons are part of a Real Python video course by Austin Cepalia.

00:00 Hi. I’m Austin Cepalia with realpython.com, and I welcome you to our series on object-oriented programming in Python 3. This is one of the biggest and most important subjects in all of programming and as you can see, we have a lot to cover.

00:16 This series will provide you with a basic conceptual understanding of object-oriented programming so that you can take your Python programming skills to the next level. To fully appreciate the subject, we have to first understand why we need it. Programs are very complex things and there’s a hundred different ways that you could define what a program is formally, but basically, all programs are a set of instructions for manipulating data in some meaningful way. When I teach Python to kids, I always have them write a program that calculates how many days old they are, and that’s a great example of a program that follows these three steps. First, the program has to ask the user for their birth date.

00:59 That’s the data it’s going to accept. Then, it manipulates the data by subtracting the current date from the user’s birth date. Finally, the program displays the result of this calculation on the screen.

01:12 That’s a great starter program, but it’s pretty trivial. How do we manage large programs with lots of data to keep track of, like a video game? As you might have guessed, that’s where object-oriented programming comes in.

01:26 Object-oriented programming, or OOP for short, is a very common programming paradigm. Informally, this means that it’s a specific way of designing programs, like a style that’s widely used in software projects.

01:41 Not every program should be written with OOP but many are, and lots of languages support it. A lot of the Python code you interact with on a daily basis will be written using OOP. Understanding this is a fundamental part of becoming a great Python programmer.

01:57 It opens the door to creating really cool software. At the heart of OOP is the idea that a program is composed of lots of individual objects. You can think of these objects as entities, or things, in your program.

02:12 Oftentimes, they are the nouns in your project, such as a person, a house, an email, or any other entity like that. These objects are like little bundles of data that are passed around throughout the life of your program. For example, a person might have properties like name, age, and home address.

02:33 This is the individual data that the object stores throughout its life in the program. When we create this Person object, we’ll make sure to give it a name, an age, and an address. Objects also have behaviors. These are the actions that the object can take.

02:50 Our person should be able to walk, talk, and breathe, for example. Oftentimes, these behaviors will need to reference the properties of the object. For example, if we make our talk behavior print the name and the age of the person, then our Person object would need to know what its name and age is—those properties we gave it earlier before.

03:12 If this all seems a little bit confusing right now, don’t worry. When I started programming, this was the first real hurdle I ran into, and it just took some dedication and practice until I finally understood it.

03:22 We’ll make heavy use of objects throughout the rest of this series and you’ll love the feeling you get when it just clicks for you.

03:30 In the next video, we’ll learn how to define our own objects using Python classes. I’ll see you there.

You must own this product to join the conversation.