Previous       Table of Contents       Next

Conventional Languages

The language used in introductory courses in the Department has changed from time to time as influenced by the evolution of programming languages and current academic fashion. With the introduction of the IBM 1620 Fortran II became available. For a short time the "AGGIE" Fortran II compiler, possibly from Texas A&M University, was used, but it was soon replaced with the WATFOR and WATFIV Fortran IV compilers from the University of Waterloo. In about 1970 Algol W, a language derived from Algol 60 and first implemented on the IBM 360 at Stanford University, replaced Fortran as the first language for Computing Science students. It was used throughout the 1970s when it was then replaced by Pascal. It was still used when I retired in 1992 but a few years later was replaced by Java. Although BASIC was first introduced at Dartmouth College in New Hampshire in 1964 as an alternative to Fortran as a first language for teaching purposes, it played a very minor role in the Department until personal computers were introduced in the early 1980s. At that time Bill Adams introduced it into the course for students in the Faculties of Arts and Education.

To show the similarities between these languages the sample problem has been programmed in BASIC using both the styles of earlier and later versions of the language, and in Fortran IV, Algol W and Pascal. These programs are shown here:

         10  REM Sample problem
	 20  DATA 20.95,29.50,22.50,13.95,19.50,0
	 30  N = 0
	 40  SUM = 0
	 50  MAX = 0
	 60  READ PRICE
	 70  IF PRICE = 0 THEN 130
	 80  N = N + 1
	 90  SUM = SUM + PRICE
	100  IF MAX > PRICE THEN 60
	110  MAX = PRICE
	120  GOTO 60
	130  PRINT N, SUM, MAX
	140  END
BASIC

        REM Sample problem
	DATA 20.95,29.50,22.50,13.95,19.50,0
	N = 0
	Sum = 0
	MaxPrice = 0
	READ Price
	WHILE Price > 0
   	N = N + 1
   	Sum = Sum + Price
        IF Price > MaxPrice THEN
           MaxPrice = Price
        END IF
        READ Price
	WEND
	PRINT N, Sum, MaxPrice
	STOP
	END
Quick BASIC

        C    Sample Program
	     INTEGER N
	     REAL MAX, PRICE, SUM
	 100 FORMAT(F10.2)
	 101 FORMAT(5X,I5,2F8.2)
	     N = 0
	     SUM = 0.0
	     MAX = 0.0
	   1 READ(5,100) PRICE
	     IF(PRICE .EQ. 0.0) GO TO 2
	     N = N + 1
	     SUM = SUM + PRICE
	     IF(PRICE .GT. MAX) MAX = PRICE
	     GO TO 1
	   2 WRITE(6,101) N, SUM, MAX
	     STOP	      
	     END
Fortran IV

             BEGIN COMMENT SAMPLE PROBLEM;
	     INTEGER N;	
	     REAL MAX, PRICE, SUM;
	     N := 0;
	     SUM := 0;
	     MAX := 0;
	     READ(PRICE);
	     WHILE PRICE > 0 DO
		BEGIN
		N := N + 1;
		SUM := SUM + PRICE;
		IF PRICE > MAX 
		   THEN MAX := PRICE;
		READON(PRICE);
		END;
	     WRITE(N,SUM,MAX)
	     END.

Algol W

        program SampleProblem;
	var
	   N : integer;
	   MaxPrice,Price,Sum : Real;
	begin
	   N := 0;
	   Sum := 0;
	   MaxPrice := 0;
	   write('Enter price: ');
	   readln(Price);
	   while Price > 0 do
	      begin
	      N := N + 1;
	      Sum := Sum + Price;
	      if Price > MaxPrice then
		 MaxPrice := Price;
	      write('Enter price: ');
	      readln(Price)
	      end;
	   writeln(N:5,Sum:10:2,MaxPrice:10:2)
	   end.
Pascal
The BASIC and Pascal programs have been debugged but the Fortran and Algol W programs have not. In writing these last two programs I have had the pleasure of consulting two texts which I haven't looked at for years: Daniel McCracken's Fortran IV text and the very different Algol W manual from the University of Newcastle. In my opinion students, and faculty too, were well-served by texts such as these, much better than they are by the large, expensive and verbose introductory programming texts used today.

There are differences, of course, between the programs given here but I consider them to be relatively minor. I have always maintained that Fortran, Algol W, Pascal and BASIC - and possibly Java although I have had no experience with it - are sufficiently similar to be grouped in a class which I call "conventional" languages. All of them have the characteristic that the basic unit is an integer or real number or a literal character, and any computation must be broken down into sequences of operations on these units. This is made very clear in any of the programs given in this section, and for that matter in any of the programs in machine language given earlier in the paper. The variables representing the number of books, the total cost and the maximum price are initialized to zero, and then they are continually updated as the successive book prices are read and processed. The same situation holds for operations on vectors and matrices for although they may be represented as single entities in a program, operations on them must, with very few exceptions, be decomposed into sequences of operations on their individual components.


Previous       Table of Contents       Next