Functional, Procedural and Object Oriented Programming Pradigm
Computers can understand only binary 1 and 0 as we already know about it. So we humans created different high level languages to ease and make faster the development.
To make code more readable and manageable there are different paradigms which are used to write code so it can be more manageable.
Functional/Procedural Paradigm:
In programming, we can write code and tell computers to execute one by one. But what if we need some part of code to be reused? Well, we have functions or methods where we can wrap up our reusable code. Now we can call anytime we want our functions or methods and reuse the same code again and again.
In functional programming we can write functions, call functions from other functions, pass functions as parameter in other functions.
Object Oriented Paradigm:
In Object oriented paradigm, we can write a program like we think in the real world. We can think like object where each object can have their own data, behavior and nature. One object can access another object. Object can secure their data by access modifiers.
So in object oriented paradigm we wrap our code and methods inside a container. We call that container classes. Each container can have any number of instances which we call objects.
Say we are designing a video game of playing ball. So a ball is an entity in real world which can have a name, a diameter, color, weight etc, a ball can have a state e.g ball is moving or still and a ball can have actions like kick a ball etc.
So in code we can think in an object oriented way and write a class named ‘Ball’ with attributes like name, color, radius, weight and methods for various actions like kickTheBall, spinTheBall etc
We just defined a ball class in code. A ball is a conceptual model. Now physically there might be as many ball we want with same or different name and same or different actions.
The physical existence of a ball is called object in object oriented paradigm.