OOP — Object-Oriented Programming Explained

Katie
2 min readDec 30, 2020

--

What is object-oriented programming and why does it matter?

In today’s technology driven society, basic knowledge in computer science concepts can be highly regarded.

Particulary in the tech space, having thorough knowledge of object-oriented programming (OOP) can be beneficial in maintaining and developing software.

What is object-oriented programming?

Object-oriented programming operates just as it sounds, through ‘objects.’

Objects are a unit, made up of variables (properties) and functions (methods).

Such objects are grouped into classes where individual objects are grouped together.

What are the common techniques for object-oriented programming?

OOP is made up of four basic techniques which act as a general framework to reinforce one’s understanding of the basics of a computer program.

The four basics of OOP are:

Encapsulation

Abstraction

Inheritance

Polymorphism

Encapsulation

In OOP, encapsulation describes combining an object’s features or attributes and methods into a single entity. E.g. a class in Java. Essentially it is a way for us to design a class, by obtaining several sets of attributes that store the current state of the object.

Abstraction

Abstraction describes the process of hiding the internal details of an application from the exterior world. Essentially, abstraction is looking to only share with the world the main attributes. The purpose is to hide any unnecessary information from users. This is achieved through access modifiers.

An example is a car. We can start a car by turning the keys or pressing the start button. As drivers, we do not need to know how the engine started or be involved in the number of components a car has. The overall internal logic and implementation is completely hidden from the user.

Inheritance

Inheritance is the ability of class to inherit methods and properties from another class. Objects may have attributes that are similar to other objects. Inheritance is a powerful and natural way for organising and structuring your software.

For example, a bicycle is a class. Mountain bikes, road bikes and tandem bikes all share the characteristics of a standard bicycle (speed, pedal, gear etc)

Polymorphism

Polymorphism describes processing objects differently based on their data type.

More specifically, it is in which a variable, function or object is able to take on multiple forms. It essentially allows to the object to take on any form and be used when called.

An example is displayed in the class Shape, and all the classes that inherit it are:

· Circle

· Triangle

· Square

Polymorphism is important as it helps developers reuse code and classes once written, tested and lastly, implemented.

--

--

Katie
Katie

Written by Katie

Self-starting UX writer & web designer, writing about user experiences, system design and the digital world. Follow me on https://www.twitter.com/therealcowlord

No responses yet