OOP in Python

What is OOP?

OOP is an acronym for object-oriented programming. Object-oriented programming is a method of programming whereby objects are created and assigned specific attributes. You have already created an OOP-focused application in the lesson about Python Classes.

Classes and methods are the foundation for OOP in Python. More involved languages, such as C++, have more structures available. You may ask, why care about OOP? The simple answer is code reuse and standardization. In the Fortune 100 software development environment, OOP designates the software engineers from the scripters. Your code will benefit from scalability and reusability from the ground up when considering OOP.

Is OOP always a requirement? No. If you are doing simple tasks, such as simple file operations or calculations, then you might not need classes and methods. Although OOP is considered a best practice, let the situation dictate if you can benefit from developing structures within your code. I would like to mention that if you are considering a service-oriented architecture (SOA), then I advise having an OOP mindset. SOA is meant to be scalable, versatile, yet independent.

OOP has four methods, which are: abstraction, inheritance, polymorphism, and encapsulation. Each layer is discussed in its own blog post, and examples are provided for each. Methods can be mixed together or used separately. The most important takeaway is that these OOP methods are meant to provide safe access to data within classes and functions; it is also meant to standardize code quality.

More information can be found in this Wikipedia article.

You can learn more about each method and see examples by clicking on the following blog posts:

Leave a Comment