Introduction to Object Oriented Programming
Object-Oriented Programming (OOP) is one of the most popular methodologies in software development. It offers a powerful model for creating computer programs. It speeds up the program development process, improves maintenance, and enhances reusability of programs.
Computer follows an Input-Process-Output cycle. It needs set of instructions called program to specify the input required, process to be Program is written in a specific language called can understand the instructions. lowed, and the output required. language, so that computer
How does a computer know what are the steps to be followed to process reservation requests? How does it manage to calculate your shopping bills at the local store? How does it generate your report card at school? Is it an all-knowing machine? Do you have to buy a different computer for each of these above-mentioned activities? The answer to the last two questions is ‘No’. It is not an all-knowing machine and you do not require a separate computer for each of these activities.
Then, how does a computer function? A computer is designed to accept input, process it, and generate output. However, it has to be provided with a set of instructions that state:
- The kind of input that will be provided. For example, in the case of reservation requests, flight date, flight time, class, and destination will be some of the inputs.
- The processing that needs to be done. For example, accepting the values, checking for availability of seats, and validating accepted values.
- The kind of output expected. For example, the seat availability status.
- A set of instructions to perform a particular job is called a program. Therefore, for each job that you want the computer to perform, you require a separate program. Instructions in a program can be:
- Sequential: Instructions that are executed one after the other.
- Decision Making: Instructions that evaluate an expression (relation or condition first and then, depending upon whether the value of the expression is ‘true’ (non-zero) or ‘false’ (zero), it transfers the control to a particular statement.
- Iterative: Instructions that are executed repeatedly, depending on the value of an expression (relation or condition).
Any real-life problem will consist of a number of small jobs. Therefore, to solve a
real-life problem, you have a number of programs that together form an application. For
example, a payroll application for processing employee compensation details and
generating paychecks and associated reports might have two programs:
Program to generate paychecks
Program to print reports