Object-oriented Software in Ada95
ISBN : 185032185X
Cover Design - Object-oriented Software in Ada95
For your free electronic copy of this book please verify the numbers below.
(We need to do this to make sure you're a person and not a malicious script)
Sample Chapter From Object-oriented Software in Ada95
Copyright © Michael A. Smith
1 Introduction to programming
A computer programming language is used by a programmer to express the solution to a problem in terms that the computer system can understand. The chapter looks at how to solve a small problem using the computer programming language Ada 95.
1.1 Computer programming
Solving a problem by implementing the solution using a computer programming language is a meticulous process. In essence the problem is expressed in terms of a very stylized language in which every detail must be correct. However, this is a rewarding process both in the sense of achievement when the program is completed, and usually the eventual financial reward obtained for the effort.
Like the planet on which we live where there are many different natural languages, so the computer world also has many different programming languages. The programming language Ada 95 is just one of the many computer programming languages used today.
1.2 Programming languages
In the early days of computing circa 1950s, computer programs had to be written directly in the machine instructions of the computer. Soon assembly languages were introduced that allowed the programmer to write these instructions symbolically. An assembler program would then translate the programmer’s symbolic instructions into the real machine code instructions of the computer. For example, to calculate the cost of a quantity of apples using an assembly language the following style of symbolic instructions would be written by a programmer:
Note: Each assembly language instruction corresponds to a machine code instruction.
In the period 1957—1958 the first versions of the high-level languages FORTRAN & COBOL were developed. In these high-level programming languages programmers could express many ideas in terms of the problem rather than in terms of the machine architecture. A compiler for the appropriate language would translate the programmer’s high level statements into the specific machine code instructions of the target machine. Advantages of the use of a compiler include:
-Gains in programmer productivity as the solution is expressed in terms of the problem rather than in terms of the machine.
-If written correctly, programs may be compiled into the machine instructions of many different machines. Hence, the program may be moved between machines without having to be re-written.
For example, the same calculation to calculate the cost of apples is expressed in FORTRAN as:
COST = PRICE * AMOUNT
1.3 Range of programming languages
Since the early days of computer programming languages the number and range of high level languages has multiplied greatly. However, many languages have also effectively died through lack of use. A simplistic classification of the current paradigms in programming languages is shown in the table below: