Software basically is a standardized set of instructions written for a computer. It is written using a programming language, which is just a medium of communication between a computer and a human. We need software to control hardware, and we also need them to do a particular task for us. Based on this distinction, softwares are broadly classified as follows:
- System Software
Software that controls the hardware and thus provides a platform for application softwares to run is a system software. They act as mediators between application softwares and the hardware. Operating systems (OS), drivers, utility programs are some system softwares. An OS is the main system software that controls all the parts of computer system.
- Application Software
Software that accomplish a specific task for a user (like billing software, accounting software, software used in departmental stores, etc) are application softwares. There are mainly three types of application software:
- Tailored Software
- Packaged Software
- Utility Software
Features of a Good Program
A good program should have the following features
The program should take the least processing time with minimum memory consumption.
The program should provide outputs to the desired degree of precision and accuracy. It must be able to accomplish the set task accurately.
The program should be readable. It should have sensible variable names, proper indentation, and comments where the logic is difficult.
The program must be properly divided into self manageable fragments, instead of writing the whole program inside a single module.
The program should not be highly specific. It should either restrict unwanted inputs, or handle wide range of inputs with appropriate feedbacks.
- Proper Error Handling
Any program must have a good error handling. A program that crashes every now and then is not a good program.
Generation of Programming Language
- First Generation (Machine-level language)
Every processor (example intel x86) has a instruction set (like add, subtract, multiply, etc) and the instructions are in binary (for example 1101101 might say add the contents of address 1101 to the accumulator). The first generation of programming was all about these binary bits. The programmer had to provide these binary instructions to the machine. This was very tiresome and error prone.
- Second Generation (Assembly Language)
Assembly language is the translation of the binary instruction into something more human. The binary instruction is divided into op code and operand (eg in the instruction 1101101, 110 might mean ADD i.e opcode and 1101 might be the address i.e operand). This language uses mnemonics (the “ADD” for 110 is an example of mnemonic). Assembly language have one to one correspondence with machine language i.e one line of instruction in machine code is one line in assembly. The code written in assembly language needs to be translated to machine language. This is done using assemblers.
- Third Generation (Procedure Oriented Language)
High level programming language begins with third generation. High level implies more human i.e. the syntax of the language is closer to human language (like if, while, etc). 3GLs make programming less prone to errors unlike machine and assembly language. Some 3GLs are FORTRAN, COBOL, BASIC, C, VB6,etc. These languages are called procedure oriented because programs written in them might consist of numerous procedures (smaller fragments of problems) which are interconnected with each other.
- Fourth Generation (Problem Oriented Language)
Fourth generation languages operate more with large collections of information at once rather than focusing on just bits and bytes. 4GL may include support for database management, report generation, mathematical optimization, GUI development, or web development. In 4GL programmers define only what they want the computer to do requiring no details of how it has to be done. Some examples of 4GL are FOCUS, FoxPro, GeneXus, SQL, Oracle, etc
- Fifth Generation (Natural Languages)
They are based on solving problems using constraints given to the program rather than using an algorithm written by the programmer. 5Gl are used mainly in AI research and expert systems. Prolog, OPS5 and Mercury are some examples of fifth-generation languages.
Categorization of High Level Languages
High level languages are mainly classified into two categories which are:
- Procedure Oriented Programming (POP)
In POP emphasis is given to functions or subroutines. Functions are a set of instructions which performs a particular task. Functions are called repeatedly called in a program to execute tasks which they perform. C is an example of POP.
- Object Oriented Programming (OOP)
OOP is developed by retaining all the best features of POP to which have been added many concepts which facilitates efficient programming. Data Encapsulation, Code reusability, Inheritance, etc are some features of OOP. C++ is an example of OOP.
Compiler is a program that translates source code to object code. The compiler looks at the entire portion of source code and reorganizes the instructions. Compilation is the process of conversion of high level machine level language to an executable. The process is as follows
- First the source code (e.g.:- .c or .cpp files) are converted to object files (.o).
- Then the object file is passed to the linker/loader which includes all necessary libraries to produce .exe file. It is at this stage that the symbolic variable are given real addresses in the memory.
An interpreter is a program that converts each high-level program statement into machine code just before the program statement is to be executed. It directs the CPU to obey each program statement at a time.
Difference between Compilers and Interpreters are
|Compiler takes the whole source code, scans it and then converts it to object code without executing a single line of code in the mean time
||Interpreter takes one line of code compiles it, executes it and then moves to next line of code.
|Compilers take some time before producing executable program.
||Interpreters can execute a program immediately.
|Compiler produces .exe files
||Interpreter produces no .exe file
|Error handling is difficult with compilers
||Interpreter makes error handling easier as they will stop the code as such as an error is encountered.
|E.g.: C, C++, FORTAN etc.
||E.g.: BASIC, LISP etc.
- A textbook of C Programming (Ram Datta Bhatta And Babu Ram Dawadi)
- Learning C By examples (Krishna Kandel)