Overview of Programming
1.1 Introduction to Computer Based Problem Solving:
Life is based on solvinng problems in our daily lives. However when using a computer for solving a problem, we must develop a well defined set of rules, which lead to the solution of the problem. To develop this defined set, we need various software and languages. In our daily lives, we solve problems informaly, following a well defined set of rules which we call experience.
The only langauage which computer can understand is in the form of 0’s and 1’s ( Binary Format). Instructions coded in binary format are extremely tedious to write and prone to mistakes. Binary format is the Machine language.
Language Software: Only machine language instructions are carried out by the computer which are streams of 0’s and 1’s. Hence instructions are written in the language which we are familiar with say English, which are then converted by the computer with the help of language software into machine language. Language software is in the form of Assembler, Compilers and Interpreters.
1. Assembler: It translates instructions written in symbolic language into binary form understood by
2. Compiler: It translate instructions written in high level programming languages like COBOL,
FORTRAN, BASIC etc. The translated instructions are kept stored in the computer memory for
3. Interpreter: Like compilers, they translate instructions written in high-level language into binary
form, but unlike compilers, they execute translated instruction on the processor immediately.
Machine Language: The fundamental method of representing information to computer is by electric pulse, which is also known as binary representation. The program written using binary numbers is known as machine language. The user having to manipulate a set of switches to load each program instructions into memory. As different codes are used to store different information it is tedium to remember them accurately enough to operate. The machine language also differs from computer to computer.
Assembly Language: The development of assembly language and assemblers was the first step toward easing the task of computer programming. In assembly language, each instruction is given as a mnemonic representation, and each memory address is represented by a name instead of a number in binary form.
The assembler, program written in machine language, takes assembly language programs in the form of source code and translates them into machine language programs which are called object programs.
Assembly language programs are much easier to write and to correct than machine language
programs. At the same time they give the programmer a high degree of control over the operation of the computer, due to close correspondence between assembly language instructions and the computer own instruction set.
High Level Language: In high-level language user specify what is to be done and the internal process of the language takes care of assign memory locations. The programmer can specify complicated sequence in a few chosen symbols and achieve a form of coding capable of translation into a machine code. High-level languages are basically symbolic languages that use English words and/or mathematical symbols rather than machine codes. Every instruction, which the programmer writes in a high-level language, is translated into many machine language instructions. It is also known as problem orientated language. A problem-oriented language is designed in such a way that its instructions may be written more like the language of the problem. Thus high-level language is generally easier to learn and write.
Low Level Language: Low-level language; against the high-level languages do not contain hardware related commands. In the low-level language the user had to specify which register in the computer memory the CPU should use. It is also known as machine oriented language. These languages have been designed to give a better machine efficiency.
Compiler: A compiler is known as translator, it takes as input a program written in one programming
language and produces as output a program in another language. If source language is high-level language
such as FORTRAN, BASIC, C OR C++, and the object language is low-level language, then such
translator is known as compiler.
Execution of a program of high level programming language is a two-step process:
1. The source program must first be compiled i.e. translated into object program.
2. Resulting object program is loaded into memory and executed.
Interpreter: An interpreter is another type of translator that used for translating high-level languages into
machine code. Interpreters are used at international meetings to translate from one language to another as
a speaker talks. It scans a source line typed in by the programmer and analyses it, immediately reporting
any error it may find. There are variety of interpreters are available for many high level languages. Although interpreters are friendlier than compilers, they also have a few drawbacks. Code that is executed by an interpreter runs considerably slower than the same source code which has been compiled and executed by an interpreter runs slower that the same code which has been compiled and is than run as object code. Another drawback is that the interpreter must be present at run time in addition to the application.
Overview of Programming Language:
We know that the computer needs instructions to perform an operation. The instructions are written in the familiar language following specific rules and syntax of the language chosen. Set of instructions written in the specific language is called the program. Thus the language used in the communication of computer instructions is known as the programming language. The computer has its own language and any communication with the computer must be in its language or translated into this language. Program is written for a specific problem in hand which can be defined as a set of instructions.
Classification of Programming Languages: There are three types of programming language:
1. Machine Language (or Low Level Language)
2. Assembly (or Symbolic) Language
3. Procedure Oriented Language (High Level Language)