Introduction
In this unit, we shall take a look at computer programming with emphasis on:- The overview of computer programming languages.
- Evolutionary trends of computer programming languages.
- Programming computers in a Beginner All-Purpose Symbolic Instruction Code (BASIC) language environment with emphasis on:
Objective
The objective of this unit is to introduce the student to the background information about programming the Computer.Overview of Computer Programming Languages
Basically, human beings cannot speak or write in computer language, and since computers cannot speak or write in human language, an intermediate language had to be devised to allow people to communicate with the computers. These intermediate languages, known as programming languages, allow a computer programmer to direct the activities of the computer. These languages are structured around unique set of rules that dictate exactly how a programmer should direct the computer to perform a specific task. With the powers of reasoning and logic of human beings, there is the capability to accept an instruction and understand it in many different forms. Since a computer must be programmed to respond to specific instructions, instructions cannot be given in just any form. Programming languages standardize the instruction process. The rules of a particular language tell the programmer how the individual instructions must be structured and what sequence of worlds and symbols must be used to form an instruction.- An operation code.
- Some operands.
Some computers use many types of operation codes in their instruction format and may provide several methods for doing the same thing. Other computers use fewer operation codes, but have the capacity to perform more than one operation with a single instruction. There are four basic types of instructions namely:
- input-output instructions;
- arithmetic instructions;
- branching instructions;
- logic instructions.
Branch instructions cause the computer to alter the sequence of execution of instruction within the program. There are two basic types of branch instructions; namely unconditional branch instruction and conditional branch instruction. An unconditional branch instruction or statement will cause the computer to branch to a statement regardless of the existing conditions. A conditional branch statement will cause the computer to branch to a statement only when certain conditions exist.
Logic instructions allow the computer to change the sequence of execution of instruction, depending on conditions built into the program by the programmer. Typical logic operations include: shift, compare and test.
Types of Programming Language
The effective utilization and control of a computer system is primarily through the software of the system. We note that there are different types of software that can be used to direct the computer system. System software directs the internal operations of the computer and applications software allows the programmer to use the computer to solve user made problems. The development of programming techniques has become as important to the advancement of computer science as the developments in hardware technology. More sophisticated programming techniques and a wider variety of programming languages have enabled computers to be used in an increasing number of applications.Programming languages, the primary means of human-computer communication, have evolved from early stages where programmers entered instructions into the computer in a language similar to that used in the application. Computer programming languages can be classified into the following categories:
- Machine language
- Assembly language
- High level symbolic language
- Very high level symbolic language.
Machine Language
The earliest forms of computer programming were carried out by using languages that were structured according to the computer stored data, that is, in a binary number system. Programmers had to construct programs that used instructions written in binary notation 1 and 0. Writing programs in this fashion is tedious, time-consuming and susceptible to errors.Each instruction in a machine language program consists, as mentioned before, of two parts namely: operation code and operands. An added difficulty in machine language programming is that the operands of an instruction must tell the computer the storage address of the data to be processed. The programmer must designate storage locations for both instructions and data as part of the programming process. Furthermore, the programmer has to know the location of every switch and register that will be used in executing the program, and must control their functions by means of instructions in the program.
A machine language program allows the programmer to take advantage of all the features and capabilities of the computer system for which it was designed. It is also capable of producing the most efficient program as far as storage requirements and operating speeds are concerned. Few programmers today write applications programs in machine language. A machine language is computer dependent. Thus, an IBM machine language will not run on NCR machine, DEC machine or ICL machine. A machine language is the First Generation (computer) Language (IGL).
Assembly (Low Level) Language
Since machine language programming proved to be a difficult and tedious task, a symbolic way of expressing machine language instructions is devised. In assembly language, the operation code is expressed as a combination of letters rather than binary numbers, sometimes called mnemonics. This allows the programmer to remember the operations codes easily than when expressed strictly as binary numbers. The storage address or location of the operands is expressed as a symbol rather than the actual numeric address. After the computer has read the program, operations software are usedto establish the actual locations for each piece of data used by the program.
High Level Language
The difficulty of programming and the time required to program computers in assembly languages and machine languages led to the development of high-level languages. The symbolic languages, sometimes referred to as problem oriented languages reflect the typeof problem being solved rather than the computer being used to solve it. Machine and assembly language programming is machine dependent but high level languages are machine independent, that is, a high-level language program can be run on a variety of computer.
While the flexibility of high level languages is grater than that of the machine and assembly languages, there are close restrictions in exactly how instructions are to be formulated and written. Only a specific set of numbers, letters, and special characters may be used to write a high level program and special rules must be observed for punctuation. High level language instructions do resemble English language statements and the mathematical symbols used in ordinary mathematics. Among the existing and popular high level programming languages are Fortran, Basic, Cobol, Pascal, Algol, Ada and P1/1. The schematic diagram of the translation process of a high level language into
the machine language is shown in the diagram below. The high level languages are, generally, described as Third Generation (computer) Language (3GL).
Social Plugin