What is Object Oriented Programming?

What you need to know about OOP — Object Oriented Programming

Luiz Felipe
3 min readMar 31, 2023

--

Summary

  • Introduction
  • What is Object-Oriented Programming?
  • What is an Object?
  • OOP — Encapsulation
  • OOP — Abstraction
  • OOP — Inheritance
  • OOP — Polymorphism
  • Conclusion

Introduction

You are interested in finally going further and learning more about OOP. This article is for you! Today you will learn what OOP is and never forget it! Trust me :)

I won’t border you with some historical stuff about programming because you can learn it at school. Today you will have a direct vision and nothing more than that; I don’t want to spend your time :) That being said, let’s get to it!

What is Object-Oriented Programming?

Well, as you may know, we have many ways to build software nowadays — but mainly, we have Functional Programming and Object-Oriented Programming.

Object-Oriented Programming

The idea comes from the real world; object-oriented has arrangements focused on solving problems by dividing things(objects) as we do in real life. The purpose of that is to organize our solution in a better way by separating things and their responsibilities as we do in real life. This way, we can improve it quickly; it is easy to understand, easy to maintain, and a bunch of other benefits.

What is an Object?

Objects in programming are nothing more than something we see the need to isolate — it can be anything. It is just essential to understand that an object usually composes of the following three things:

  • Properties -> The features of an Object.
  • Methods -> The actions of an Object.
  • Events -> The events that the object itself can process.

Composed of these three things, you have an object in any Object-Oriented Programming Language. Usually, in C#, we declare objects as Classes using the built-in keyword. class

You can learn more about it in this article:

OOP — Encapsulation

Encapsulation is the idea of keeping together what makes sense to be together; the more you split your objects, the better. In the process of encapsulating a functional programming logic into objects, variables become properties, and functions become methods.

Usually, encapsulated objects have the following points (as already mentioned):

  • Properties
  • Methods
  • Events

OOP — Abstraction

The concept of abstraction is to expose just the necessary to outsiders' objects; the less you expose your object, the better.

OOP — Inheritance

The main thing we must understand about inheritance is its benefit, which is bringing everything within the object we are inheriting to our object — giving us the benefit of code reuse.

OOP — Polymorphism

Polymorphism is the most important one and definitely the most asked in tech interviews. Polymorphism describes situations in which something occurs in several different forms.

Bringing it to programming, let’s say we can inherit objects by using the inherit OOP concept, and then we can change the behavior of a method or properties inherited — this is polymorphism! When we have the power to change the shape of something that was already created. Not that harder, huh?

In C# we can do it by using virtualor override keywords.

Conclusion

In this article, we covered the main principles of Object-Oriented Programming. The idea was to make it extremely simple for you to understand the concepts themselves and not dive into any code details.

Hope you enjoyed it! Thank you, and have a good one :)

--

--

Luiz Felipe
Luiz Felipe

Written by Luiz Felipe

Senior Back-End Engineer | .NET Core

No responses yet