Check out a free preview of the full Intermediate Python course:
The "Object Oriented Programming" Lesson is part of the full, Intermediate Python course featured in this preview video. Here's what you'd learn in this lesson:

Nina introduces what object oriented programming is, and what it means for the Python language.

Get Unlimited Access Now

Transcript from the "Object Oriented Programming" Lesson

[00:00:00]
>> Nina Zakharenko: Next, we're gonna talk about, classes, objects and object oriented programming. Object oriented programming, it allows us to represent our code in a much different way. Organized intaclasses. The concept of object oriented programming, it's a language model or a paradigm where properties or behaviors are organized into objects.

[00:00:25] Some programming languages, they encourage a more procedural style, like COBOL or BASIC. You just go through everything step by step. You're not jumping to other parts of the program necessarily. But more modern languages, they tend to adopt an object oriented style to organize things into objects and provide methods for those objects to communicate with each other.

[00:00:54]
>> Nina Zakharenko: So what is an object? In Python, it can be a function, it could be a variable, a property, it could be a class. Everything in Python is an object. It's a very kind of important concept. When you think of some type of languages, like Java, it has these, what you can think of, primitive types, like an int.

[00:01:18]
>> Nina Zakharenko: And that int is just kind of a very bare bones, kind of more down to the level type of,
>> Nina Zakharenko: Type, it's not an object. Whereas in Python, as we saw, even the integers, they're an object. You can call a method on them. So in Python everything is an object.

[00:01:48]
>> Nina Zakharenko: You can think of the objects that we're gonna make kind of like a generic container.
>> Nina Zakharenko: We can even make our own objects that maybe look something like a list. To do that, you would have to use magic methods, which I'm not going to cover today, but something to keep into mind.

[00:02:08]
>> Nina Zakharenko: And if you wanted to make your object that looks kind of a list, you might have some helper methods on it. Like code that might be executed on the whole list or maybe some of the items on the list. Just a way to group these concepts together.

[00:02:27] Python buys pretty heavily into this object oriented model. But that doesn't mean that you always have to use objects or classes in your programs. Python also, as we've seen, works perfectly fine in a procedural sort of way.
>> Nina Zakharenko: Like a scripting language, where one command is just executed one after the other like a recipe.

[00:02:49] But as you get familiar with object oriented programming, as you read more Python code written by other people, you'll really learn to help you encapsulate your thinking, encapsulate your code into objects for better organization, and readability, and reuse. And maintainability, code maintainability is always important. So objects in Python, they're center stage.

[00:03:16] Representing not just the data, but the overall structure of your programs.