Difference between OOP and POP
Object-Oriented Programming (OOP)
- OOP treats data as a critical element in the program development and does not allow it to flow freely around the system.
- In OOP, the major emphasis is on data rather than procedure (function).
- It ties data more closely to the function that operate on it, and protects it from accidental modification from outside function.
- OOP allows decomposition of a problem into a number of entities called objects and then builds data and function around these objects.
- The data of an object can be accessed only by the function associated with that object. However, function of one object can access the function of other objects.
- C++, Java, Dot Net, Python etc are the example of Object oriented programming (OOP) language.
Some Characteristics of Object Oriented Programming:-
- Emphasis is on data rather than procedure (function).
- Programs are divided into objects.
- Functions that operate on the data of an object are ties together in the data structure.
- Data is hidden and cannot be accessed by external function.
- Objects may communicate with each other through function.
- New data and functions can be easily added whenever necessary.
- Follows bottom up approach in program design.
Features of OOP (Object Oriented Programming):-
- Data Abstraction
- Data binding
- Message Passing
Application of Object Oriented Programming:-
- User interface design such as windows, menu
- Real Time Systems such as Control system for cars, aircraft, space vehicles etc
- Office automation system such as Document Management System i.e. Word processing system, spread sheet software etc
- AI and Expert System
- Neural Networks and parallel programming System
- Decision support system etc
Advantages of OOP:-
1. Improved software-development productivity:
Object-oriented programming is modular, as it provides separation of duties in object-based program development. It is also extensible, as objects can be extended to include new attributes and behaviors. Objects can also be reused within an across applications. Because of these three factors – modularity, extensibility, and reusability – object-oriented programming provides improved software-development productivity over traditional procedure-based programming techniques.
2. Improved software maintainability:
Since the design is modular, part of the system can be updated in case of issues without a need to make large-scale changes.
3. Faster development:
Reuse enables faster development. Object-oriented programming languages come with rich libraries of objects, and code developed during projects is also reusable in future projects.
4. Lower cost of development:
The reuse of software also lowers the cost of development. Typically, more effort is put into the object-oriented analysis and design, which lowers the overall cost of development.
5. Higher-quality software:
Faster development of software and lower cost of development allows more time and resources to be used in the verification of the software. Although quality is dependent upon the experience of the teams, object oriented programming tends to result in higher-quality software.
Disadvantages of OOP:-
1. Larger program Size:
Object oriented programs are much larger than other programs. In the early days of computing, space on hard drives, floppy drives and in memory was at a premium. Today we do not have these restrictions.
Object oriented programs require a lot of work to create. Specifically, a great deal of planning goes into an object oriented program well before a single piece of code is ever written. Initially, this early effort was felt by many to be a waste of time. In addition, because the programs were larger, coders spent more time actually writing the program.
Object oriented programs are slower than other programs, partially because of their size. Other aspects of Object Oriented Programs also demand more system resources, thus slowing the program down.
Procedural Oriented Programming (POP)
- In the procedure oriented approach, large programs are divided into smaller programs known as functions.
- In POP, a program is written as a sequence of procedures or function.
- In POP, each procedure (function) contains a series of instructions for performing a specific task.
- During the program execution each procedure (function) can be called by the other procedures.
- To call a procedure (function), we have to write function name only.
- While we concentrate onto the development of functions, we give very little attention to the data that are being used by various functions.
- In POP, the major emphasis is on procedure (function) and not on the data.
- In a multi-function program, many important data items are placed as global so that they may be accessed by all the functions. Each function may have its own local data.
- Global data are more vulnerable to an accidental change by a function. In a large program it is very difficult to identify what data is used by which function.
- Examples of procedural oriented programming language are COBOL, FORTRAN, PASCAL, C programming language etc.
Characteristics of procedure-oriented programming:-
- Large programs are divided into smaller programs known as functions.
- Most of the functions share global data.
- Data move openly around the system from function to function.
- Functions change the value of data at any time from any place. (Functions transform data from one form to another.)
- It uses top-down approach in program design.
- In POP, global data can be accessed & changed by any procedure (function) so there is no data security. In case if we want to change type of data of global data, then we also need to resolve all functions that access the data. Due to this it may happened that some errors will occurs
- POP does not model real world problems because functions are action oriented.
Difference between OOP and POP:
|Object oriented.||Structure oriented.|
|Program is divided into objects.||Program is divided into functions.|
|Bottom-up approach.||Top-down approach.|
|Inheritance property is used.||Inheritance is not allowed.|
|It uses access specifier.||It doesn’t use access specifier.|
|Encapsulation is used to hide the data.||No data hiding.|
|Concept of virtual function.||No virtual function.|
|Object functions are linked through message passing.||Parts of program are linked through parameter passing.|
|Adding new data and functions is easy||Expanding new data and functions is not easy.|
|The existing code can be reused.||No code reusability.|
|use for solving big problems.||Not suitable for solving big problems.|
|C++, Java.||C, Pascal.|