Liam Lee

What is Object-Oriented Programming (OOP)?

What is it?

What type of concepts exists?

What is its benefits?

What is Object-Oriented Programming (OOP) in general?

Object-Oriented Programming (OOP) is a commonly used concept of ‘template’ when programming. This ‘template’ makes the code to be organized and reusable for the programmer to utilize. Not only this will make the code to be well organized, but it can also upgrade its efficiency.

There are several concepts that the OOP relies on. Such as:

  • Class
  • Object
  • Constructor
  • Acessor methods (setters, getters)
  • Interface
  • Abstraction
  • Encapsulation
  • Inheritance
  • Polymorphism
  • Design patters

Let's go over each, one by one.

Class

Classes are the ‘template’ I mentioned before. Because it acts as a ‘template’, classes do not have actual data in them. Instead, they have a simple block of code that acts as an example of what we wish to create. This block of code doesn’t have any parameters inside and is simple enough for the code to be reusable.

Object

Objects are the unique blocks of codes that are made using classes. Each object has its unique parameter or data for the code to be successfully executed.

Constructor

Constructor is simply the process of the programmer making an object using classes.

Acessor methods (setters, getters)

Also called setters or getters are lines of code that sets or gets variables for the class to use.

Interface

A set of methods that allow things to happen.

Abstraction

Sometimes not knowing something can be easier to understand. The same applies when coding. Abstraction hides complex lines of code to make the code look organized and simple.

Encapsulation

Grouping similar functioning codes into an object is called encapsulation. This makes the code be read much easier, due to its organization. This can improve the code's reusability.

Inheritance

It copies the parent class’ properties and pastes it to itself for itself to be reused.

Polymorphism

Is basically ‘if statements’ and ‘switch cases’ in a nutshell. It takes one condition and gives out solutions depending on different outcomes. This makes the programmer be much more organized when coding eliminating the repeating lines of code due to ‘if statements’ or ‘switch cases’.

Image example of Polymorphism

Design patters

Reusable solutions to commonly occurring problems and software designs.

Conclusion

As mentioned several times, the purpose of OOP is the code to look simple. Making the code simple can help the programmer to understand the code with ease.