Q 1. Explain the terms:
- Procedure Oriented Programming
- Object Oriented Programming
Ans. Procedure Oriented Programming: In Procedure Oriented Programming:
- Programs are divided into procedures/ functions.
- It is procedure centric.
- Supports modular programming.
- POP employs top-down style of programming.
- When program size increase then difficult to manage the program’s complexity.
- Data can flow freely among the different functions.
- Refer figure 1.1 in your book.
More about POP:
Procedural programming is a programming paradigm, derived fromstructured programming, based upon the concept of the procedure call. Procedures, also known as routines, subroutines, or functions (not to be confused with mathematical functions, but similar to those used in functional programming), simply contain a series of computational steps to be carried out. Any given procedure might be called at any point during a program's execution, including by other procedures or itself. Procedural programming languages include C, Go, Fortran, Pascal, and BASIC.
Computer processors provide hardware support for procedural programming through a stack register and instructions for calling procedures and returning from them. Hardware support for other types of programming is possible, but no attempt was commercially successful (for example Lisp machines or Java processors).
Object Oriented Programming: In Object Oriented Programming:
- Programs are divided into number of classes and objects.
- It is data centric.
- Supports Encapsulation, Polymorphism, Abstraction, Inheritance, Class, Objects and Message passing.
- OOP employs bottom-up style of programming.
- Easily maintain the complexity of program size.
- Data is more secure and closely tied with functions so it can’t move freely among the functions.
- Refer figure 1.2 in your book.
More about OOP: -
- It implements real life scenario.
- In OOP, programmer not only defines data types but also deals with operations applied for data structures.
- Much suitable for large projects.
- OOP provides a clear modular structure for programs.
- Implementation details are hidden from other modules and other modules has a clearly defined interface.
- It is easy to maintain and modify existing code as new objects can be created with small differences to existing ones.
- More reliable software development is possible.
Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which may contain data, in the form of fields, often known as attributes; and code, in the form of procedures, often known asmethods. A feature of objects is that an object's procedures can access and often modify the data fields of the object with which they are associated (objects have a notion of "this" or "self"). In OOP, computer programs are designed by making them out of objects that interact with one another. There is significant diversity of OOP languages, but the most popular ones areclass-based, meaning that objects are instances of classes, which typically also determine their type.
Significant object-oriented languages include Java, C++, C#, Python, PHP, Ruby, Perl, Delphi, Objective-C, Swift, Common Lisp, and Smalltalk.