Page 220 - DCAP104_EXPOSURE_TO_COMPUTER_DISCPLINES
P. 220
Unit 11: Programming Process
In Matlab Notes
The same program in Matlab would be the following:
z = 0;
x = 3;
while x ~ = 0
z = z + y;
x = x — 1;
y = z;
Or the following:
y = y*3;
11.3 High Level Languages
A high-level programming language is a programming language with strong abstraction from the
details of the computer. In comparison to low-level programming languages, it may use natural
language elements, be easier to use, or be more portable across platforms. Such languages hide
the details of CPU operations such as memory access models and management of scope.
Very early in the development of computers attempts were made to make programming easier
by reducing the amount of knowledge of the internal workings of the computer that was needed
to write programs. If programs could be presented in a language that was more familiar to the
person solving the problem, then fewer mistakes would be made. High-level programming
languages allow the specification of a problem solution in terms closer to those used by human
beings. These languages were designed to make programming far easier, less error-prone and to
remove the programmer from having to know the details of the internal structure of a particular
computer. These high-level languages were much closer to human language. One of the first of
these languages was Fortran II which was introduced in about 1958. In Fortran II our program
above would be written as:
C = A + B
which is obviously much more readable, quicker to write and less error-prone. As with assembly
languages the computer does not understand these high-level languages directly and hence they
have to be processed by passing them through a program called a compiler which translates them
into internal machine language before they can be executed.
Another advantage accrues from the use of high-level languages if the languages are standardized
by some international body. Then each manufacturer produces a compiler to compile programs
that conform to the standard into their own internal machine language. Then it should be easy to
take a program which conforms to the standard and implement it on many different computers
merely by re-compiling it on the appropriate computer. This great advantage of portability of
programs has been achieved for several high-level languages and it is now possible to move
programs from one computer to another without too much difficulty. Unfortunately many compiler
writers add new features of their own which means that if a programmer uses these features then
their program becomes non-portable. It is well worth becoming familiar with the standard and
writing programs which obey it, so that your programs are more likely to be portable.
As with assembly language human time is saved at the expense of the compilation time required
to translate the program to internal machine language. The compilation time used in the computer
LOVELY PROFESSIONAL UNIVERSITY 213