4 Computer Software, Programming Language and Program Development
4 Computer Software, Programming Language and Program Development
6.0 Objectives
6.1 Introduction
6.2 Classification of Software
6.3 Programming Languages
6.4 Program Development Process
6.5 Summary
6.6 Check your Progress - Answers
6.7 Questions for Self – Study
6.8 Suggested Reading’s
6.0 OBJECTIVES
6.1 INTRODUCTION
6. 2 CLASSIFICATION OF SOFTWARES
A B
1. Application Software a. Program to control system working of computer
2. Firmware b. Scandisk
3. Systems Software c. payroll
4. Utility Software d. Software available on Rom chips
- Input/output operations,
- Arithmetic operations - mathematical operations like addition, subtraction,
- Logical operations - Comparison for equality, inequality etc.
- Movement of instructions and data to and from the CPU.
To use the programming language, the programmer has to strictly follow the rules of
Computer Fundamentals/72
the language including all commas, punctuation marks etc. otherwise the program will
not be understood by the computer. Thus, although the programming languages are
much smaller and simpler than the natural languages, they have to be used with the
greatest accuracy.
a) Machine Language:
This is the only language which is understood by the computer. This is the
language nearest to the machine. In this language the programs are written in binary
code i.e. the instructions are made only by a combination of binary digits 0 and 1.
Machine language may vary from machine to machine depending upon the computer
architecture. Machine languages execute the fastest since they are immediately
understood by the computer. No translation
of the programs is required. Also they make efficient use of primary memory. But it is
very difficult to program in this binary or machine language. It is also very tedious and
time consuming, since all the instructions have to represent as a series of Os and 1 s.
Therefore there is always a possibility of errors.
b) Assembly Language:
The Os and 1 s of the machine language were substituted by letters and symbols in
assembly languages. The assembly languages use mnemonics (memory aid) in place
of operation codes. The language uses symbols instead of numbers to write programs. A
program written using such symbols in the assembly language is called the source
program. The program written in assembly language has to be converted into machine
language for use by the computer. This is achieved with the help of the assembler. The
assembler is a system program which is supplied by the manufacturer. It converts the
assembly program into a machine readable program and the resulting program is
called the object program. Thus the input to the assembler is the source program
and the output of the assembler is the object program. The assembler translates
each assembly language instruction into a corresponding machine code.
It is relatively easy to write programs in assembly language as compared to machine
Since the machine language and assembly language both are dependent on the
hardware, they are referred to as low level programming languages. Both these
languages require a deep understanding of the internal structure of the computer.
I) Compiler
II) Interpreter
I) Compiler:
The compiler translates the entire source program into machine language
program at once. The source code remains intact. Once a program is compiled it can be
run as many times as required, without being required to be recompiled. A compiler
can translate only those programs which have been written in the language for which it
is designed. Also each machine has to have its own compiler.
A compiler is a program which normally resides on the secondary storage
device. It gets loaded into the CPU when the source program is to be translated. A
compiler checks for errors like illegal symbols, statements etc. during compilation and
gives out a list of error messages at the end of execution. This is a very valuable aid to
the programmer to correct the programs. However, the compiler is incapable of
detecting any logical errors in the program.
II) Interpreter:
The interpreter is the program which translates a high level language program
into machine language as follows :
- it takes one statement from the high level language program
- translates it into a machine instruction and the instruction is immediately executed.
Since the program is translated statement by statement, the machine level program of
the source program is not stored anywhere in memory.
Therefore, the program has to be interpreted every time when it has to be run.
Thus no object code is generated. The interpreted programs are generally slower than
compiled programs. However, if any changes are made in the source program it can
interpret only those statements and it is not required to compile the entire program
again. Interpreters are relatively easy to write and smaller in size as compared to
compilers.
Thus assemblers, compilers and interpreters are systems software which
translate the source program into object program i.e. program which can be understood by
the computer. These translators are also known as language processors.
Computer Fundamentals/74
The First Generation - Machine Language
The Second Generation - Assembly Language
The Third Generation - High4.evel Language
Unlike procedural languages which require that a programmer writes all the
steps to complete the program and generate output, which are related to a more
structural approach towards programming. It is the first standardized language.
BASIC:
BASIC stands for Beginners All Purpose Symbolic Instruction Code. The
language was developed by Prof. John Kemeny and Thomas Kurtz in USA. It
irrelatively easy to learn. Programs written in BASIC language are interpreted. It
resembles FORTRAN in many ways, but can also be effectively used in business
applications. Thus it can be used for both business and scientific applications. BASIC
is one of one most popular language for use in microcomputer systems.
COBOL :
Common Business Oriented Language was designed especially for
business applications. A COBOL program is constructed from sentences, paragraphs,
sections and divisions. A COBOL program must have four divisions: the identification
division, the environment division, data division, and the procedure division. Thus
COBOL is a self documenting language. It is one of the most widely used commercial
languages.
RPG :
Report Generator is a general purpose, business oriented language designed to
generate output reports. The language was developed by IBM and was launched for
use on the IBM 1401 computer. It is best suited for applications where large data files
have to be read and extensive reports are to be output. It has limited mathematical
capability and is not suited for scientific applications.
PASCAL :
PASCAL has been named after the French mathematician Blaise Pascal; It allows the
programmer to structure the programming language. The features of PASCAL allow it
to be used for both scientific and business applications. It is a very powerful language.
It is implemented on several computers including microcomputers and minicomputers
and is also widely used to teach programming to students and beginners.
C:
C was designed and developed at Bell Laboratories USA. It is a block structured
language which allows the use of various concepts of structured programming. C also
has the advantage of being able to manipulate internal processor registers of the
computer. Thus it has some powers of the assembly language. C is also very portable.
C is the most popular language used for systems programming like designing
compilers and operating systems.
LISP:
LISP stands for list processing. This language is mostly used in non numeric
applications which require logical rather than numerical operations. Therefore it is
widely used in games, pattern recognition and artificial intelligence.
Flowchart :
A flowchart is a pictorial representation of the algorithm. It represents the
steps involved in the procedure and shows the logical sequence of processing using
boxes of different shapes. The instruction to be executed is mentioned in the boxes.
These boxes are connected together by solid lines with arrows, which indicate the flow
of operation.
The first step in the design of a program is the algorithm. The algorithm is
then represented in the form of a flowchart and the flowchart is then expressed in the
computer language to actually prepare the computer program.
Computer Fundamentals/76
Fig. 6.2 Symbols used in a
flowchart.
Terminal (Start/Stop):
The symbol denotes the beginning, ending and halt operation in the program
logic. Thus it is the first and the last Symbols! in any nov-chart to indicate the start and
stop of the process.
Input/output:
Indicates when an input or output operation is to performed in the process.
Processing:
This represents the arithmetic operations like addition, subtraction etc, and
the movement of data in the process
Decision:
The decision symbol is used to represent a point where one or more alternatives
is possible. The criteria for decision making are written in the decision box. On each
path the condition for which the particular path is to be followed has to be written. During
the execution the appropriate path will be followed depending upon the result of the
decision.
Flow lines:
These indicate the flow of operation ie. The sequence of instruction execution. Flow
lines are normally drawn with arrowhead indicating the direction of flow of the program.
Connectors:
A connector is used to indicate the logic flow from one page to another when
the flowchart becomes very long. Connectors do not represent any operation. They are
mainly used in the flowchart for clarity and convenience.
Sequential Execution: In this logic the instructions are executed one after the
other sequentially.
Transfer of control: This is a logic which is used when the option to be chosen
depends upon the result of the decision. The control is transferred to a particular path if
the result of the decision branches to that path.
Solution :
Next on the basis of this step wise algorithm develop the flowchart using the
appropriate flowchart symbols as follows:
Fig 6.3
(2) Write an algorithm and flowchart to read two numbers A and B and compare
them. If
A is greater than B print, A is greater than B else print B is greater
than A. Algorithm :
Step 1: Start.
Step 2: Input values of A and B.
Step 3: Compare values of A and B (Is A >
B?).
Step 4: If yes then print “A is greater than B”.
Step 5: If no, the print “B is greater than A”.
Computer Fundamentals/78
Other techniques which can be useful in designing of the program are:
Modular Programming:
Using this method the entire program is divided into smaller manageable
modules so that the smaller modules can be designed, coded and debugged
separately.
Top-Down Design:
Here the overall problem is first defined in terms of general subtask. These
subtasks are divided into further sub tasks.
6.4.3 Coding:
Once the design process is complete, the actual computer program is written,
i.e. the instructions are written in a computer language. Coding is generally a very small
part of the entire program development process and also a less time consuming activity
in reality. In this process all the syntax errors i.e. errors related to spelling, missing
commas, undefined labels etc. are eliminated. For effective coding some of the
guidelines which are applied are
Use of meaningful names and labels of variables,
Simple and clear expressions,
Modularity with emphasis on making modules generalized,
Making use of comments and indenting the code properly,
Avoiding jumps in the program to transfer control.
6.4.4 Debugging:
At this stage the errors in the programs are detected and corrected. This stage
of program development is an important process. Debugging is also known as
program validation.
The tools or methods which can be used to debug the programs include:
Simulator -This is a computer program which simulates the execution of the
program on another computer.
Logic Analyzers: This test instrument detects the states of digital signals
during each clock cycle and stores them in memory. It then displays this data on
the monitor.
Breakpoints: This is introduced in the program to halt the execution at
some intermediate point. At this point, the values of the various inputs, outputs,
variables etc. can be checked.
Software interrupts: This is an instruction which saves the current value of
the program counter and then branches to a specific memory location. At this
location there is the debugging program which displays the status information.
Memory dump: This gives a listing of the current contents of a section of
the memory. Memory dumps are common in most simulator programs, and
microcomputer systems.
Trace routine: This program prints the current status of the processor at
specified intervals.
6.4.6 Documentation:
Documentation is a very essential step in the program development.
Documentation help$ the users and the people who maintain the software. This
ensures that future modification if required can be done easily. Also it is required
during redesigning and maintenance.
6.4.7 Maintenance:
Updating and correction of the program for changed
conditions and field experience is accounted for in maintenance.
Maintenance becomes essential in following situations:
- Change in specification,
- ChangelrY equipment,
- Errors which are found during the actual execution of the
program. Modularity, structured programming, thorough testing
and debugging and proper documentation greatly reduce the time
and cost of maintenance of the software.
Computer Fundamentals/80
Check your Progress - 6.4
1. Answer in 1-2 words.
a. Name any two stages in the development
of a computer program.
................................................................................................
................................................................................................
b. Name any two tools used to develop the program design,
................................................................................................
................................................................................................
c. Name and draw any two symbols used in
flowchart,
...........................................................................................................................
...........................................................................................................................
d. List any two methods used for debugging the program.
...........................................................................................................................
............................................................................................................................
e. List any two situations where the maintenance stage of program development
becomes essential.
..........................................................................................................................
...........................................................................................................................
2. Write algorithms and draw flowcharts for the
following:
a) Input the marks of five subjects of a student.
Calculate the percentage and print the grades as follows:
Grade A for 90% and above, grade B for percentage greater than or
equal to 75 and less than 90 and grade C for percentage less than 75.
b) Find the area and perimeter of a rectangle given the sides s1
and s2.
6.5 SUMMARY
Application Software : These carry out specific applications like payroll, financial
accounting etc.
Systems Software : This set of programs controls the execution of the computer
system. It controls the functions of the other software’s, and hardware.
High Level Languages : They make use of English like words and statements and
are easy to learn. They are translated into machine language with the use of
compilers and interpreters. Some of the commonly used high level languages are
FORTRAN, BASIC, COBOL, RPG, PASCAL, C, LISP etc.
Fourth Generation Languages : These are non procedural languages. They are
normally used in conjunction of a data base and its data dictionary.
Program Design : Tools like algorithms and flowcharts are used to design the program.
The techniques employed in design are modular-programming, top-down design.
Testing : A test plan for the program which has been done at the design stage is
applied here to test the program on a number of suitable test cases.
Computer Fundamentals/82
6.4
1. a) Problem definition, program design b) Algorithm, Flow chart
c) Connectors, Flow lines d) Break points, simulators e) Change in
specification, change in equipment.
2 a) Algorithm :
Step 1 : Start,
Step 2 : Input marks of five subjects (ml,m2,m3,m4,m5).
Step 3 : Calculate percentage (p = (ml -i- m2 + m3 + m4 + m5)/5).
Step 4 : Check if percentage (p) >= 90.
Step 5 : If yes, print “A grade”.
Step 6 : If no, check if percentage (p) >= 75.
Step 7 : If yes, print “B grade”.
Step 8 : If no, print “C grade”. Step 9: Stop.
Stop
b) Algorithm :
Step 1 : Start.
Step 2 : Enter the sides of the rectangle s1 and s2.
Step 3 : Calculate area (A) = s1 x s2.
Step 4 : Calculate perimeter (P) = 2 * (s1 + s2).
Step 5 : Output area (A) and perimeter (P).
Step 6 : Stop.
REFERENCES
http://www.tutorialspoint.com/
Computer Fundamentals/84