Table of Contents
PROGRAMMING CONCEPT | CONCEPT OF COMPUTER PROGRAMMING
Computer Programming means writing or chalking down a sequence of steps (called instructions) to achieve a desired task. Let us take a real life example. When some one wants to talk to his friend on telephone, he is following a sequence of steps such as pick up of receiver, dialing of the telephone number of the friend and finally talking to the friend. The steps followed may be in a favorable condition where no ifs and buts are observed or these may be in different conditions such as telephone is engaged or friend is not available on the line. Accordingly, the calling person shall decide the steps. This means that a situation in favorable conditions may be different from the one in unfavorable condition. The programming is carried out again for achieving the task by the person.
Computer programming is a similar activity. It is a process of writing the instructions for problem solving on computer under different possible conditions. Computer programming is yet different from the real life programming. The computer programming is concerned with the unity of effective, precise, unambiguous, definite and finite instructions for problem solving. Computers can be programmed in tedious manner i.e. the programmer writes the instructions directly in the language of computer. Computers are programmable in an easy way i.e. the programmer can write the instructions in an English like language.
Computer programming is in some sense an art or a science. It is also sometimes called software development process. In the next section, we study the program development process.
COMPUTER PROGRAMMING DEVELOPMENT PROCESS
To solve a given problem on a computer, it is required to develop a computer program. We discuss the steps involved in designing a program from initial problem specification. Computer programming is a complex task consisting of a number of phases. By organizing computer programming activity into a series of well defined steps, the task of programming will be manageable.
The process of program design must be carefully distinguished from the term program writing. Program writing or writing of code in a programming language is just a small part of the total process of program development. By the time, code is written, the program should have been conceptualized, structured, and, for all intents and purposes, developed. The coding is simply a means of implementing the ideas that are the real essence of the program.
A well designed computer program possesses the following properties
- (I) It produces accurate and reliable results,
- (II) It is easy to implement,
- (iii) It is easy to use, and
- (IV) It is easy to maintain.
To develop a good program having above mentioned properties, it is necessary attempt the problem solving in a systematic way. The major phases involved in any problem solving on computer are as follows:
- (a) Specify and analyze the problem,
- (b) Prepare and represent an algorithm for the problem,
- (c) Code the algorithm into a suitable programming language,
- (d) Debug the coded program for errors, if any,
- (e) Test the program,
- (f) Document the developed program, and
- (g) Maintain the program for future references.
In practical situations, these phases of program design are rarely independent. It is often necessary to return to previous phases for further investigations before reaching satisfactory outcome. The lack of attention in giving proper weightage to any of the phases may lead to a significant amount of unnecessary and unexpected work. For instance trying to perform phases numbered (c) and (d) together often leads to coding, taking precedence over the preparation of algorithm which is most likely to make the process of program development unmanageable. We now have a brief look at the various phases of program design.
Specify and Analyze the Problem
It is quite obvious that if a problem is not well specified, the resulting program be unsatisfactory. Normally, the problem originates from a person who is from non-computer field. In true sense, the problems posed are virtually useless in their initial form. It is the programmer’s responsibility to ensure that he or she has obtained complete specification of the problem. Regular meetings with problem originator may be essential for the purpose.
Consider the problem of adding two numbers. The problem may be given by the user that given two number should be added by the computer. While putting up the problem the user might be quite clear in his mind about the problem, but the programmer will have to inquire whether numbers are real or integer? Can numbers be negative? What is the range of the magnitudes of the number ?, etc.
Specifications should involve establishment of an understanding of the requirements for input, output, processing, and storage.
Input specifications:
Input specifications mainly involve (i) Various inputs and the values, (ii) Possible range of each input (iii) Ways of giving input values and (iv) Specific characteristics of input values, if any.
Output specifications:
Output specifications must be decided based on (i) What all outputs are required? (ii) How outputs are to be presented? (iii) Any heading etc. required (iv) Amount or volume of the output.
Processing:
The processing required on inputs to generate outputs must be understood clearly, particularly concentrating on special conditions which can occur during the processing. Handling of abnormal conditions should be specified clearly.
Storage:
The organization and access of information throughout the processing should be outlined after giving due considerations to merits and demerits of various information organization methods available. The manner in which data is organized will influence the efficiency of the program. It should be approximately, if not exactly, determined that how much memory is needed to store the information (data and instruction) pertinent to that problem.
The analysis of problem is really the first phase of algorithm preparation. Generally, a large problem can be divided into a number of subproblems which can be individually solved in a well managed manner. It should be clearly defined that what are the responsibilities of each task and how these individual tasks interrelate and interact. It should also be ensured that the pieces being developed separately are designed in the context of whole problem.
Prepare and Represent an Algorithm for the Problem
This is the most difficult phase of the program design. To design an algorithm which must work satisfactorily for all possible sets of data, is not an easy task. An algorithm not only should be designed to produce correct results but it should also be efficient in terms of resources utilized by the program including the time needed to execute the program.
Coding
The conversion of algorithm to instructions in a programming language is known as coding. This is a simple task but requires a bit of care. Coding is more of a mechanical work which can be done by a person knowing the programming language. Not much of intelligence and logic is required at this stage.
The programming language used for coding depends on
(1) The characteristics of the problem,
(ii) Availability of the languages, and
(iii) Future considerations.
Debugging
A program not able to work as per the requirements is said to have bugs. Hunting for errors and correcting them is known as debugging. Broadly, the errors in a program can be divided in two categories, logical error and syntactic error. A logical error is an error which results incorrect or produces the outputs which are not desirable. Such errors are very difficult to debug. Main reasons for logical error may be that the algorithm developed is not correct i.e. the logic used in processing of inputs is not appropriate for a subtask of the problem; or the statements written in the program are not performing the required task. For instance, a variable used in the program is not declared of the required type (real or integer). Intelligent design of algorithm can only avoid the possibilities of logical errors.
Violation of the syntax and grammar of the language creates syntactic errors in the program. Such errors can easily be corrected because in the process of compilation they will be pointed out. Compiler will not be able to translate a statement or part of statement to machine code if the statement is not as per the rules of the grammar of the language. A program can be compiled successfully only if it does not posses any syntactic error.
Testing
Obtaining results from the execution of programs is not enough. It must be guaranteed that the results produced are correct. Testing is a procedure for running the program with data representatives of all anticipated processing conditions that will be encountered so as to find logical errors. Test data can be prepared by the programmer and user together.
Documentation
Documentation is the comprehensive description of what the program does and how it works. It can be done in two parts, one is technical documentation for the programmer and other is the user-level documentation for user of the program. The documentation should include details about inputs, outputs, processing and formats of information storage.
Program Maintenance
program Once a program is developed, it may be used for long time. However it may be necessary to make changes in the program with time. Such an activity is called maintenance and is required if:
- (i) A bug is found,
- (ii) Some amendments are required at a later stage, and
- (iii) Additional tasks are to be performed by the program.
It is not uncommon to locate a bug in the program on a particular set of data after the program has been used for a long time. Such error will also have to be removed.
Program Deployment
A large program or a set of programs after its complete development is deployed at the location (or site) of the customer for its use in the organization. The process of deployment is also well planned so that it is tuned correctly with the hardware systems owned by the customer.
CHARACTERISTICS OF GOOD PROGRAMS
Every computer system works only when it is programmed. A good program shall make the computer good for the user. Assuming that the structure of a computer is good, it is now the behaviour of the computer needs to be good. The behaviour is decided by the programs working in the computer. The computer becomes a computer system that contains a set of good programs. The responsibility of having good programs lies with the programmer who writes instructions in a good manner. The instructions must be accurate, understandable, precise and well-written. If the instructions are properly written, the proper functionality of the computer system can be ensured. Hence, the sequence of instructions must be organized in such a way that it is ensured to have the logic of problem solving implemented and the desired results are obtained from the computer system.
A good computer programming consists of a well organized sequence of instructions. Thus, the instructions should follow the characteristics as under:
- It is descriptive to represent the logic of problem solving step.
- It follows the proper syntax of the description.
- It is written with no ambiguity.
- It fits in the overall control flow of the program.
- It is supported by documents, wherever applicable.
While writing instructions individually, their sequencing should be so done, that results in a good program. A good program is said to have the following characteristics:
Efficiency:
A good program takes minimum time to execute and at the same time, it requires the minimum amount of memory. Such programs are challenging to write and needs a great deal of problem solving and programming skills.
Consistent structure:
A good program has a consistent structure in terms of modular division of tasks into subtasks.
Generic logic:
A good program has a generic logic approach to solve all similar tasks. There are several generic logics such as divide & conquer, recursion, modularity, dynamic programming, etc.
Sufficient documentation:
A good program contains a good deal of documentation i.e. a program segment is explained by a small description so that other programmers can understand the code easily. The documentation should clearly indicate the functionality of a program segment.
Portability:
A good program is portable ie. it should run on all similar computers equally. It should also run on dissimilar computers having different environments with proper interfacing techniques.
PROGRAM PLANNING | COMPUTER PROGRAMMING PLANNING
At first, writing a computer program is not an easy task. To make it as an easier task, one has to do planning without a proper plan, either a bad program shall be resulted or no program is evolved. The planning gives a proper idea to the software developer, that indicates what exactly is to be done and where to begin with. A good plan normally consists of three things:
- Input items,
- Output items,
- Processing methodology.
The input items are the data elements which shall be entried when a program is running or these may be part of program itself. For example, roll no, marks in subjects are input items.
The output items are those elements which are resulted out from the program execution in a proper format. The output elements are not simply data elements, they are useful with some or more information content. For example, total marks, merit list, pass/fail results are output items.
The processing methodology includes the ways of formulations, and instruction writing. A good processing methodology is one that is problem oriented and procedure oriented. All the arrangements of correct and error-free formulation are made in the processing methodology. A formal plan is structured in the form of a table as shown in Table below. In this, an example of computation of aggregate percentage of marks is depicted.
Table- Plan for percentage computation.
Input items | Processing methodology | Output items |
|
|
|
Hope you liked this article on “Computer programming”. You are invited for any kind of suggestion or feedback in the comment box. You can also mail us your suggestions or feedback directly at theinstrumentguru@gmail.com. To read more such articles related to Technology, Electronics and Instrumentation. You can also download our Android App. Click here to download the mobile app.
Read Also
- Number System | Types, Conversion rules & Examples
- P&ID symbols | ISA Symbols and Loop Diagrams
- Difference between analog and digital signal
- What is LVDT ? | Types & Applications
- Digital Integrated Circuit | What is an ICs?
- Resistor transistor logic (RTL)
- Diode Transistor Logic (DTL)
- Direct coupled Transistor Logic (DCTL)
- What is Algorithm and Flowchart