Object-Oriented Programming (OOP) is a programming paradigm that creates programs while focusing on the idea of "objects" in terms of the data and code. Data are tidied in the form of fields, or better known as attributes/properties, and code, in the form of procedures (methods).
In OOP, objects are mainly created using a class template. The attributes and behaviors (methods) can be written in this class template. The objects are created when needed according to the class definition. One of the important characteristics of OOP is that the various created objects are able to work and interact with each other easily to achieve code efficiency.
To put classes and objects into an example, take the "Vehicle" as an example and see how to create a specific "Vehicle" object. The "Vehicle" class will define what general behavior and attributes a "Vehicle" will have. Based on this class, we are able to derive other classes that follow this general behavior and also create objects out of that single class.
By learning about OOP, we would be able to visualize the program and code it using the concept of objects.
By structuring the program's code in accordance with the OOP paradigm, we will be able to utilize benefits brought from it, ranging from data independence, extensibility, and reusability. These benefits allow for the ease of adding functionalities and editing of code.
For example, if we need to change the behavior of an object, we are able to make the edits without affecting other objects created using other different classes, as long as the original class was created with OOP in mind.
Learn about the concepts of OOP to write code that promotes maintainability.
Learn from Here
Here are some of the basic OOP concepts that we will need to learn when we focus on the OOP paradigm.
Understanding the Basics of OOP
Classes and Objects
Instantiate an Object from a Class
Object Methods and Class Methods
Progate is an online platform to learn programming. Learn to build your own apps and services.
This article has provided a simplified view of object-oriented theory — this isn't the whole story, but it gives you an idea of what we are dealing with here. In addition, we have started to look at different ways of generating object instances.