INSTRUCTION
Basic commands that tell the computer processor to do something are called instructions.
PROGRAM [2] [072] [074]
A collection of instructions written to solve a particular problem is called program. A program is like a
recipe, which contains a list of ingredients (called variables) and a list of directions (called
statements) that tell the computer what to do with those variables.
PROGRAMMING [1] [2074]
Process of writing instructions using a programming language is called programming or coding.
PROGRAMMING LANGUAGE [2] [071] [073]
We humans use natural language such as English, Nepali, Newari etc to communicate our ideas and emotions
to others. Similarly a programmer uses programming language to communicate with the computer.
Programming Language is the standardized communication technique between a computer and a human being.
Each programming language has a set of syntactic and semantic rules used to define computer programs.
1. LOW LEVEL LANGUAGES
Low-level languages are closer to the computer hardware.
Low-level language is of 2 types
a. Machine languages / Machine code (1st GL)
The language in which programs are written in binary code (composed of 0 and 1) is called Machine language
and it is the only one language that the processor directly understands.
b. Assembly languages (2nd GL)
The language in which programs are written in mnemonics (short codes) like ADD, SUB, MUL, etc. instead of
writing instruction in binary numbers (0 and 1) is called Assembly language. Computer viruses are mostly
written in this language.
2. HIGH LEVEL LANGUAGES
High-level languages are similar to natural language (human language) [068]. It is so called because
functions used in high level programming languages are similar to the words that we use in natural language.
For example, to print the content in a standard output device (like monitor) we use printf() in C
programming language, which is similar to printing a document from a printer that we may use in natural
language. Also to represent integer (whole number, i.e. not a fractional number, that can be +ve, –ve or
zero) variables, we use ‘int’ keyword which is also close to natural language. Program written in high-level
languages are translated into machine language by a language translator called a compiler or an
interpreter.
High-level language is of 3 types [4] [068] [067]
a. Procedural oriented languages (3rd GL)
Language that follows step-by-step instruction to solve a particular problem is known as procedural
language. Therefore it mainly focuses on writing the algorithm before coding.
In procedural oriented languages, program is divided into small parts, where each part is called a function.
In procedural oriented languages, importance is not given to data but to functions.
Procedural oriented languages follows the Top Down approach.
Most functions use Global data for sharing, which can be accessed freely from function to function.
They don’t have data hiding options.
Example: C, FORTRAN, Pascal
b. Problem oriented languages(4th GL)
These languages are non-procedural languages which allow the user to specify what the output should be,
without describing all the details of how the data should be manipulated to produce the result. They are
result oriented, and need a translator like an interpreter or a compiler. Their main objective is to
increase the speed of developing programs.
Examples: MATLAB, Oracle, MySQL, MS-SQL
c. Natural languages(5th GL)
Natural languages are still in the developing stage. On completion, we would be able to write statements
that would look like normal sentences. They are designed to make computers solve problems without a
programmer. They are used in the areas of research, robotics, defense system and different types of expert
systems.
Examples are LISP, PROLOG, Mercury
LOW LEVEL LANGUAGES VS. HIGH LEVEL LANGUAGES[4] [073] [069]
|
|
Low Level Languages |
High Level Languages |
Advantages |
Execution Speed |
Execute faster than high level language. |
Execute slower than low level language. |
Translation |
Machine language does not need any translation. Assembly language needs an Assembler to
translate an Assembly language code into Machine code. |
Required translation is done by compilers or interpreters. |
Memory |
Require less memory space. |
Since it uses compilers and interpreters, they require large memory space. |
Disadvantages |
Machine Dependencies |
Very machine dependent, i.e. a machine code written for Intel processor doesn't work for Motorola
processor. |
Machine independent, i.e, program in one processor easily runs on another processor also. |
Easiness |
Difficult to learn, which in turn requires sound knowledge of computer architecture. |
Easier to learn because it is similar to English language. |
Debugging |
Debugging is tough and difficult. |
Finding and correcting errors in high level language is easy. |
Example |
Mnemonics code is used in 8085 and 8086 microprocessor. |
FORTRAN is the first high-level language. C, C++, .NET, JAVA are other examples. |
GENERATION OF PROGRAMMING LANGUAGE [4] [069][070][072][073]
1st Generation Programming Language (1940-1950)
Machine Language
2nd Generation Programming Language (1950-1958)
Assembly language
3rd Generation Programming Language (1958-1985)
Procedural Oriented language, FORTRAN, Pascal etc.
4th Generation Programming Language (After 1985)
Problem oriented language, Mat-lab, Oracle, MY-SQL, MS-SQL
5th Generation Programming Language (After 1990)
Natural Language, LISP, PROLOG, Mercury
Note: For detailed explanation of "Generation of Programming Languages", refer to the
above-mentioned "types of programming languages."
FEATURES OF A GOOD COMPUTER PROGRAM [4][069][071]
- Accuracy: Every program must give the correct output for correct input. Otherwise, no program
can be useful.
- Clarity: The logic implemented in a program should be readable and intelligible, so that it can
be clearly understood with little effort.
- Modularity: While developing a program, we should divide the problem into different modules if
possible, which can be accomplished using functions in C.
- Efficiency: A good program consumes minimum memory & executes within short period of time.
- Easy to maintain and update: Should be easy to maintain and update for future use.
- Simplicity: There may be a number of ways to develop a program but it is better to choose the
simplest one.
SOFTWARE [1][070]
Software are a collection of computer programs designed to perform a well-defined task that provides a good
user interface and are documented with operating procedures manuals.
Software = programs + good user interface + documentation + operating procedure
Types of Software [3][070][072]
1. System Software
The software used to control and coordinate computer hardware and software is called System Software. It
is responsible for resource management, memory management, file management, tasks scheduling etc.
2. Application Software
Application software does their tasks with the help of an operating system. They are of following types.
- Tailored software:
Tailored software is customized software designed to fulfill the specific requirements of an
organization, office or individual. E.g. Hospital Management Software, Ticket Reservation, School
Management Software, Air Ticket Reservation, Banking Software etc.
- Package software:
Packaged software is readymade software developed for all general users to perform generalized tasks.
One of the most prominent examples is something like the Microsoft Office package, which includes
individual applications such as Word, Excel, Access and PowerPoint.
- Utility software:
Utility software is helpful software that performs tasks related to the maintenance of computer hardware
and data. Disk cleanup, system recovery, antivirus, WinZip etc. are common examples of utility software.
COMPILATION PROCESS[4] [069]
The process of translation from high level language(source code) to low level language(object code) is
called compilation. Compilation process consists of the following steps.
-
Source code:
The code written by programmer using a particular programming language is called source code. Source
code is the only format that is readable by humans. When we purchase programs, we usually receive them
in their machine-language format. This means that we can execute them directly but we cannot read or
modify them.
-
Compiler:
Compiler is a program that translates source code into object code.
-
Object code:
The intermediate code produce by a compiler is called object code. Object code is often the same as or
similar to a computer’s machine language. Object code needs to be converted into executable code using
linkers.
-
Linker:
A linker is a program that combines all object modules to form an executable program. We need to link a
program even if it contains only one module. A linker is also called a binder.
-
Executable code:
Code that is ready to run is called executable code or machine code.
COMPILER VS. INTERPRETER [2] [067][071]
|
Compiler |
Interpreter |
Advantages |
It takes entire program as input. |
It takes single instruction as input. |
Intermediate object code is generated after successful compilation which can be executed many times
whenever needed if there are no changes in source code. |
Intermediate object code is not generated, so it must perform the translation process each time a
program is executed. |
Control statements are executed faster. |
Control statements are executed slower. |
Disadvantages |
Memory requirement is more since object code is generated. |
Memory requirement is less since no object code is generated. |
Error message are displayed only after scanning the whole source code. So after correction of error
it needs to be compiled right from the very beginning. |
When error is found no further code is scanned. And after correction of error, interpretation can
resume from there. |
Compiler is not so good for Debugging. |
Interpreter is good for debugging. |
Example |
C, C++, FORTRAN etc |
PHP, Pearl, Python, Ruby, Javascript, MATHLAB etc. |
Note: To combine the advantages of both compilers and interpreters, the program development
environment of a computer system provides both a compiler and an interpreter for a
high-level language. In these cases, the interpreter is used to develop and debug programs. Then, when a
bug-free state is reached, the programs are compiled to increase their execution speed. Java and .NET
languages use both compiler and interpreter for better performance.
COMPILER VS. ASSEMBLER [3] [068]
Compiler |
Assembler |
Compilers are used to translate high level languages (like C,C++) into machine code. |
Assemblers are used to translate assembly language into machine code. |
The compiler takes high level language as its source code. |
The assembler takes low level language as its source code. |
Compiler is more popular than Assembler. |
Assembler is less popular than compiler. |