Introduction to Object-Oriented Programming (OOP)


In this lesson, we’ll introduce the object-oriented programming (OOP) paradigm.

So far, we’ve discussed procedural/structured programming, which portrays its modularity in terms of functions and structures, which group together various variables under a single category. OOP is a paradigm that emphasizes the organization of code around objects and encapsulates both data and the operations that can be performed on that data. It provides a better data abstraction than procedural and structured programming. It introduces the concept of data hiding, which makes the code more modular and easier to maintain, allowing reusability and scalability.

OOP concepts

In OOP, classes, objects, abstraction, encapsulation, and object relations (such as composition, association, and aggregation) enhance code organization and design. While inheritance and polymorphism are important aspects, we won’t cover them in this course. Our focus will be on the foundational aspects of OOP.


In the realm of object-oriented programming (OOP), two essential concepts are abstract data types (ADTs) and cohesion. ADTs provide a conceptual framework for defining classes and objects, while cohesion refers to the idea of keeping related parts of a codebase together.

ADTs in OOP serve as blueprints for creating classes. For example, consider the concept of a “car” as a class. The attributes of the Car class can include properties such as color, model, and horsepower, which are all adjectives that describe the car. The behaviors or actions of a car, such as turning the engine on/off, controlling lights, accelerating, and braking, can be implemented as member functions within the Car class.

We achieve high cohesion by organizing attributes and behaviors within a class based on their logical relationship. This means that related attributes and functions are kept together, enhancing code organization and readability. For instance, all the attributes related to the car’s appearance can be grouped together, while the functions related to controlling the car’s movements can be grouped separately. This approach ensures that the class remains focused and self-contained.

By utilizing ADTs and striving for high cohesion, OOP promotes a structured and modular approach to software development. Classes act as ADTs, providing an abstract representation of objects, their attributes, and behaviors. Cohesion aids in maintaining the integrity of classes by grouping related attributes and functions together, resulting in more organized and maintainable code.

So, in summary:

  • Nouns \rightarrow Classes

  • Adjectives \rightarrow Member attributes

  • Behaviors \rightarrowMember functions

  • Proper Nouns \rightarrow Actual instances of corresponding classes

Structure vs. class

The high-level block diagram below compares the relationship between functionality and attributes in structured programming and OOP.

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy