Lesson 14Incorporating Object-Oriented Programming

This lesson looks at tools that help us use Python as an object-oriented language, which allows us to create classes, objects, and methods that we can reuse in other parts of our code.

OBJECT-ORIENTED PROGRAMMING OVERVIEW

Object-oriented programming (OOP) is a programming paradigm based on objects. OOP solves problems by carrying out all computations on objects. We use objects in code to represent real-world concepts that our code will interact with, such as employee IDs or employee types. Objects allow us to streamline development by reducing redundant code.

There are four principles that define and differentiate object-oriented programming. These principles are encapsulation, abstraction, polymorphism, and inheritance. We will discuss inheritance in detail in the next lesson.

The basic object in this approach is the class, which represents primary things or concepts we want to reuse in the overall solution. We create one class per object and include properties ...

Get Job Ready Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.