Blog Görseli

OOP (Object Oriented Programming)

30.01.2025 | Hasamuddin Afzali

Object-Oriented Programming (OOP) is a fundamental and essential concept in software development. It emerged as a solution to the shortcomings of procedural (structured) programming, which was commonly used before.

In procedural programming, applications could not be divided into modular parts. As a result:

  • Every developer working on the application had to be familiar with almost the entire structure of the project.
  • New developers joining the project required a long adaptation period.
  • Changes made to the application often caused significant issues and took a long time to implement.

In the 1960s, Object-Based Programming (OBP) was introduced to address these challenges. This idea was pioneered by Ole-Johan Dahl and Kristen Nygaard. The object-based approach is built on the following principles:

  • Every object should belong to a class.
  • Classes should represent the common behaviors of objects.

OOP aims to model everything in the real world within software. This makes applications more modular, easier to understand, and more manageable. The benefits of OOP include improving speed and quality during software development while enhancing the maintainability of projects.

For example, the lack of a modular structure in an application makes it difficult for developers to adapt to the project and can lead to severe issues when changes are made. OOP seeks to overcome such problems.

Core Principles of OOP

Core Principles of OOP

OOP is based on four key principles:

  1. Polymorphism
    Enables the same operation to be performed in different ways. For example, a Draw() function can draw both a circle and a rectangle. Learn more in my Polymorphism article.
  2. Encapsulation
    Encapsulation hides data and the methods related to that data within a class, preventing unauthorized access. Learn more in my Encapsulation article.
  3. Inheritance
    Allows one class to inherit the properties and behaviors of another class. This eliminates code duplication and promotes a more organized structure. Learn more in my Inheritance article.
  4. Abstraction
    Hides unnecessary details and highlights only the essential features. Learn more in my Abstraction article.

Conclusion

In this article, we’ve introduced the fundamental concepts of OOP. The principles mentioned above form the foundation of OOP, and you can explore them in detail through the provided links.