What is Object Oriented Programming?

Aldrin Caalim
Probably Programming
4 min readApr 4, 2022

--

Image by nonbirinonko from Pixabay

Object Oriented Programming Explained

Object Oriented Programming (OOP) is a programming paradigm that emphasizes the use of classes and objects to represent entities in a computer system. OOP concepts include classes, objects, abstraction, polymorphism, inheritance, and encapsulation.

What are Classes?

Classes are a fundamental component of object oriented programming. A class is a template for creating objects. The programmer defines the class’s properties and methods, and then creates instances of the class to represent individual objects. Classes allow the programmer to encapsulate common functionality in a single place, and to reuse that functionality in multiple objects.

They are used to create modularized programs. Modularization means breaking a program down into smaller pieces that can be treated as separate problems. By separating the program into small, self-contained units, it becomes easier to understand and maintain.

Classes also provide an abstraction layer between the programmer and the underlying data structures. This allows the programmer to manipulate data without knowing exactly how it’s formatted. This flexibility is critical in many applications, such as database management systems (DBMSs).

What are Objects?

Objects are fundamental in object oriented programming (OOP). In OOP, objects represent individual entities in a computer system. You can think of an object as a miniature program that resides in memory. You can create and manipulate objects using special programming techniques known as “object-oriented techniques.”

One key benefit of using objects is that you can easily share code between different parts of your program. This is because objects are self-contained units. You don’t have to worry about maintaining the relationship between one object and its siblings — the compiler takes care of it for you.

In addition, objects make it easy to modularize your codebase. This is important because it allows you to divide your program into smaller, more manageable chunks. As your program grows, it becomes easier to add new features and components without affecting existing code.

What is Abstraction?

Abstractions play a critical role in object oriented programming (OOP). They allow programmers to focus on the behavior of individual objects, rather than on the details of their implementation. In this article, we explore what abstraction is and how it helps OOP programmers design efficient and robust software.

First and foremost, abstraction is a process of reducing complexity by removing detail from an entity or concept. For example, consider a bank account. A bank account has all the basic information associated with it (name, balance, etc.), but most people don’t need to know that information in order to use the account. By abstracting away this information, we can focus on the functionality of an account — paying bills, withdrawing money, etc. — without having to worry about its underlying structure.

What is Polymorphism?

Polymorphism refers to the ability of a class to behave differently depending on the type of object that is used to instantiate it. For example, a class may have one function that works with Strings, but another function that works with Numbers. This functionality is made possible by polymorphism, which means that the class defines two separate functions, one for String objects and one for Number objects.

It is an important part of object oriented programming because it allows different types of objects to be treated the same way. This makes development much simpler because different elements of a program can be handled by separate classes instead of having to write code specifically for each type of object.

The benefits of polymorphism are clear. It makes code more readable and easier to maintain because it allows different types of objects to be treated in the same way.

What is Inheritance?

Inheritance in object oriented programming is a process of allowing classes to reuse the code and functionality of other classes. This can be done by creating a new class that is based on an existing class and then defining what properties and methods the new class should have. The existing class can then be used as a template for the new class. When this is done, the new class will behave like the original class, but with added functionality.

What is Encapsulation?

Encapsulation means hiding the implementation details of a class from other classes that use it. An example of encapsulation would be a class that represents a person. The person class might have properties such as name, age, and height. Another class that uses the person class might want to know only about the properties named name and age. The person class would not want to expose its height property to other classes because this information is internal to the class and not needed by any other class.

--

--