Tuesday, May 10, 2011

COMPUTER PROGRAMMING: FUNDAMENTALS PART2

MACHINE LANGUAGE

All computers use the binary number system, comprising the binary digits, 0 and 1 for performing internal operations. Machine language is the only language that uses binary digits, to represent an instruction. Therefore, the computer can directly process the instructions written in machine language.
A number of languages can be used to write programs. However, the computer understands only machine language. The programs written in other programming languages need to be translated to machine language for execution.
The machine language program being written in binary digits is difficult to learn because it is difficult to read and understand. For example, a program instruction to print a number might be
1011001111101001   1110110011001111
NB: The binary number system uses the base of 2. For example, 101 in the binary system is equal to 5 in the decimal system.
The conversion can be done as:
101=1*22 + 0*21+ 1* 20 =1*4 + 0*2 + 1*1 = 4 + 0 + 1=5
Machine language is also called a first-generation language.

Advantage of the Machine Language
The main advantage of the machine language is that computer programs written in a machine language execute fast. This is possible because machine instructions are in binary form, which are directly understood by the computer and no translation of the instructions is required.

Limitations of the Machine Language
Machine language has the following limitations:
·         Machine language programs are difficult to write because the programmer either needs to remember all the operation code or refer constantly to the reference card of the computer. The programmer also needs to remember the memory locations of the data.
NB:A reference card is a documented form of machine instructions for a computer. It lists the binary form   of various machine language instructions such as print and read.

·         The machine language code differs from one type of computer to another. This is because the internal design of each type of computer varies from other types and needs different signals to operate.
·         Machine language programs are error-prone because it is difficult to write a machine language program. A single error of a 0 or 1 can change the interpretation of the program.
Programs written in a machine language are difficult to modify because of their complexity.

No comments:

Post a Comment