Search⌘ K
AI Features

Introduction to OOP

Explore the fundamentals of object-oriented programming in Python. Understand how to think in objects, create classes and objects, and apply key concepts such as encapsulation, inheritance, polymorphism, and abstraction to write modular, scalable, and maintainable code.

Thinking in objects

Up till now, we have been thinking in terms of variables and functions. This is what is called the procedural programming paradigm. It focuses on functions and follows a top-down approach by breaking down problems into smaller functions. The functions are then called in a manner such that the problem is solved. An important characteristic of procedural programming is that it treats data and functions as separate entities.

In many real world scenarios different data and the operations allowed on them are usually related and bundled in a unifying theme. To design such a program, it is better to think in terms of individual entities.

Confused? Let's take an example.

Suppose we are writing code for a mobile phone contacts application. A ...