In a description of OOP in my textbook, it is written that “in procedure oriented program the program is organized around its code while in object oriented programming, the program is organized around its data”. What is the meaning of this statement? An explanation with an example would be of great help.
Before answering the question you have to understand the difference between code and data. Data(input) is a raw fact that manipulates into a new data(output) and Code defines the behaviour like how that data converts to that form.
As we know procedural programming is to divide the program into pieces(module) and then work on separate piece ; These pieces are distinct and interrelated. Every data is local to its piece i.e data is only manipulated by the code within piece.This Doesn't mean the data never be changed , it cannot be manipulated from outside but can be over written. Now the question arises how data be over written?
It is matter of fact that a new module by a new member can accidentally use the variable(data) that is already be used in other module.Thus the value being return from other module is overwritten. Thus insignificance of a data cause a Procedural programming to be organised around code.
Thus Object Oriented programming is build to focus more over Data (Generally both code & data).Like procedural programming having pieces or modules , OOPs having 'Classes';Code & data are bind as an object thus you can independently use the data regarding the class.To overwrite it you have to use the same object regarding of that same class.So in OOPs if a new class is created then there is no way you can overwritten the values because to overwrite the data you need same class in which the object is created.Thus OOPs is organised around data.
There are different approaches to find solutions to problems in computer science.They are called paradigms. Procedural and OOP are two kind of paradigms.
uses instructions to tell the computer what to do step by step.
For example: cobol,fortran,c
Object oriented programming
approach to problem solving where all calculations are carried out by objects.
For example: java,php,c#
What is the difference?
In Procedural programming The steps of code(instructions) determine and controls the way of working the program.But in Object oriented programming based on objects.An object is a instance of class. Class is a group of objects with common properties and common behaviours. Once you have created class, You can use that class any where in the code.That means , Code doesn't determines the way of working the program.But program is dependant on the internal structure of the class. That means, It is dependant on the attributes and behaviours(data and the way of handling those data). So now It is clear that, “in procedure oriented program the program is organized around its code while in object oriented programming, the program is organized around its data”