Computer Programming And Programming Approaches
What Is Program?
A program is a set of instructions written by a programmer. Program contains detailed instructions and complete procedures for performing the relevant tasks.
What Is Programming?
Programming is an art, although we can learn and taught it, but the creativity and problem solving skills is God gifted.
A program has following processing operations in its working:
- Reading an input record for processing
- Arithmetic calculations to produce statements
- Comparison of values to perform certain operations
- Output of items on output devices
- Moving data from memory to storage or vice versa
- Giving a data item a certain value (initialization process)
- Looping/repeating certain instruction to process data in the same way
- Branching in case to perform specific instruction for some records
- Controlling instructions to start/stop program, allocation of storage, and checking for hardware errors
Programming Approaches / Program Design
What is program design?
As we all are familiar with the term program which means a set of instructions which has been written by a programmer. Program design is concerned with how the programmer arranges these instructions in a program. There are a number of ways in which a programmer can write a program but not all are effective.
In this article, we discuss some important/popular approaches which are as follows:
- Modular Approach / design
- Structured approach / design
- object oriented approach / design
- event driven approach / design
1. Modular approach / design
In this approach a full program is divided into small programs called a sub program. This sub program may carry not more than 80 lines of the instructions. This sub program is called a module.
In this type of programming approach, the programmer starts dividing the system into programs and then programs into sub-programs (modules). Then after division, the programmer writes the sub-programs and put them together to make a program and after that all these programs will be finally combined to make a System which is needed to be developed. For example, if we take the example of a MS-Word, we say that it is a system in which documentation, spelling and grammar check and formatting are programs. And then the formatting program is further divided into different modules namely bold, italic and underline etc.
Modular approach can be further divided into two:
- Top-Down Approach – In this type of approach the programmer first make the overall design of the system to get an overview and then divide them into programs and modules. After doing all division the programmer start programming the system. It is the most recommended approach.
- Bottom-Up Approach – In this type of approach the programmer never made any design of the system. The programmer directly starts dealing with the modules when he feels that any particular module is necessary.
2. Structured Approach / Design
In this approach the system is programmed in a well-designed manner. All the instructions are arranged in a way which makes the system more reliable. In this system there are three main principles on which the system is based. These principles are
- Modularity – discussed above.
- In this approach, the programmer use one entry / exit point. This is requiring so that a programmer will be satisfied that the each module is working properly and the programmer will be able to run an individual module whenever required.
- In this approach, the programmer never use any command like GOTO which has the function of jumping.
3. Object-Oriented Programming / Design
This is a programming approach in which data and instructions are group together as an object. There are many languages in the market which has the policy to disintegrate the data from the procedures and actions which relate to that data. But the specialty of the Object Oriented Programming languages is that it will combine the data and the procedure / action into objects. So in these languages an object consists of both data and the actions to be performed on that data. Once we program an object, it can be reusable. Today many developers consider object oriented languages in many software developments. These languages are in use since 1960’s and include Actor, small talk and C++ etc.
For example, there is an object which contains a data about the employee and also contains the accounting operations such as payroll calculations or provident fund which might be performed on the data. Or in another example you may not need to draw up on the screen by series of instruction, instead, we can send a window object to open it and it will appear on the screen. This will appear because the window object which we use possesses the program code for the opening of itself.
4 . Event Driven Approach / Design
Event driven approach goes hand-in-hands with object orientation. The objects are activated on different events (a key press or click).