31
Gary Marsden Slide 1 University of Cape Town A brief history of programming languages Gary Marsden Semester 2 – 2000

Gary MarsdenSlide 1University of Cape Town A brief history of programming languages Gary Marsden Semester 2 – 2000

Embed Size (px)

Citation preview

Gary Marsden Slide 1University of Cape Town

A brief history of programming languages

Gary MarsdenSemester 2 – 2000

Gary Marsden Slide 2University of Cape Town

What is a programming language?

Originally, computers were hard-wired to perform one task only

Von Neumann realised that instructions could be stored with data, making computers general purpose

“Machine language” was therefore the first programming language

Gary Marsden Slide 3University of Cape Town

Low level

Originally, languages were bit patterns (1st generation)– 101010101100010111110100110101

Eventually, mnemonics were used to produce a human readable version of the above– LDA (2), #45

At least this is now readable by humans as well as machines

Gary Marsden Slide 4University of Cape Town

Moving from low level

As humans programmed in low level languages, it became apparent to them that they were expressing the same ideas over and over; e.g. iteration

Low level languages could not express such concepts

Furthermore conceptually identical programs looked radically different as LLL are closely tied to individual machine architectures

Gary Marsden Slide 5University of Cape Town

Becoming abstract

It became clear that programming languages would need to express the types of abstractions humans dealt with

This required languages to be come more human readable, hence the term– high level language

These HLLs need to be translated into a LLL to be executed – more later.

Gary Marsden Slide 6University of Cape Town

What abstractions

What are the abstractions which people want?

There are two basic types– Control Abstractions – Data Abstractions

We can examine these abstractions in terms of– Basic abstractions– Structure abstractions– Unit abstractions

Gary Marsden Slide 7University of Cape Town

Basic Data abstractions

The most basic data abstraction is the variable

Variables have a type (e.g. integer, real)Variables are allocated a name during

declaration– var x: integer; (Pascal/Modula-X)– int x; (C/C++/Java)– Dim x as Integer (Visual Basic)

Gary Marsden Slide 8University of Cape Town

Structure Data Abstractions

Data structures allow related data types to be collected together and dealt with as a unit

Common to most languages is the array– a: array [1..10] of integer; (Pascal)– INTEGER a(10) (Fortran)– int a[10]; (C/C++/Java)

Gary Marsden Slide 9University of Cape Town

Unit Data Abstractions

Especially useful for programming in the large, unit abstractions allow grouping (and abstraction) of everything which deals with one data type

These were originally called abstract data types (Clean, Modula-2) but you would know them as objects– Package (Ada)

Gary Marsden Slide 10University of Cape Town

Basic Control Abstractions

Basic abstractions are those that combine a few machine instructions into a HLL equivalent– GOTO statement (BASIC, FORTRAN) replacing

“Jump” instructions– Assignment statement (all imperative

languages) replacing memory->register->memory statements• := (Pascal derivatives)• = (C derivatives)• put the value of field “x” into field “y”

(HyperTalk)

Gary Marsden Slide 11University of Cape Town

Structured control abstractions - branching

At a higher level than GOTO is the notion of a conditional branch

This can be an “if..then..else” or a “switch” statement

When should one be used in preference to the other?

What about dangling elses?

Gary Marsden Slide 12University of Cape Town

Structured control abstractions – iteration

Within imperative programming there is the idea of repeating code a number of times

This may be a fixed number of times – for loops

Or may depend on a condition– while loops– until loops

Or may be infinite– LOOP..EXIT..END (Modula-2)

Gary Marsden Slide 13University of Cape Town

Structured control abstractions – packages

Originally, there were labelled subroutines – execution jumped to these code blocks

The idea evolved to functions and procedures (and event handlers) which can have– declarations with optional parameters– calls or invocations, where they can be

passed– arguments, or actual parameters

Gary Marsden Slide 14University of Cape Town

Unit Control Abstractions

Really, a unit control abstraction suggests different chunks of program which can run independently

Java has threads, but other languages have co-routines– Process (Modula-2)– Task (Ada)

Of course, Clean doesn’t require explicit specification of this

Gary Marsden Slide 15University of Cape Town

History

Now that we have looked at the key abstractions of programming languages, it is worth looking at where they came from and how they developed

Gary Marsden Slide 16University of Cape Town

FORTRAN

The first high level language was developed at IBM by John Backus (important chap) in 1957

Name stands for FORmula TRANslation Is still around as FORTRAN90 because

– compilers are very efficient– only language engineers learn

Introduced– arrays– for loops– branching if statements

Gary Marsden Slide 17University of Cape Town

COBOL

COmmon Business Oriented Language, developed by the DoD in 1960 by Grace Hopper

Designed to keep track of lots of data (network database model)

Verbose language which could not specify complex calculation, but did provide– record structure– separation of data specs from code– advanced formatting

Gary Marsden Slide 18University of Cape Town

Algol 60

ALGOrithmic Language was designed by committee in 1960

Aimed at allowing algorithms to be expressed

Influence felt in every language Introduced

• blocks• first structured statements• type declarations• call-by-value• stack based run time implementation

Gary Marsden Slide 19University of Cape Town

Lisp

LISt Processing language was written by John McCarthy in late 50’s

McCarthy was a big figure at MITAimed at list processing as a tool for AIBased on lambda calculus – not Von

Neumann Introduced

• run time environment• garbage collection

Gary Marsden Slide 20University of Cape Town

The sixties

The 4 languages we looked at have had tremendous impact on subsequent language development

In the sixties it became popular to design your own language and there followed hundreds of (thankfully) defunct languages

We shall briefly look at the exceptions

Gary Marsden Slide 21University of Cape Town

PL/1

IBM decided to create the definitive programming language – one language for all purposes

Consequently they created a language with many advanced concepts, such as concurrency and exceptions.

As these concepts were not well understood, implementations were slow and unreliable

Through market domination, IBM made PL/1 a ‘success’ and still support it

Gary Marsden Slide 22University of Cape Town

BASIC

Beginners All Purpose Symbolic Language started life as a teaching alternative to FORTRAN

Designed at Dartmouth college for an interactive time sharing system

Hence it became the de-facto standard on interactive terminals

Still hugely popular thanks to MicrosoftDijkstra has some thoughts on the

language

Gary Marsden Slide 23University of Cape Town

Dijkstra on Basic

“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of recognition.”

Gary Marsden Slide 24University of Cape Town

Other oddities

Although SNOBOL is no longer with us, its children are– It was the first language to process strings,

giving us the joys of awk and perl.

Simula67 was created as a superset of Algol60 in Norway– Built for programming simulations, it was the

first language to group data and functions together in a “class”

– It is widely credited as the first object-oriented language

Gary Marsden Slide 25University of Cape Town

The seventies

The seventies was really a reaction to the confusion of the sixties

Languages designers sought to re-think language design

This led to ‘lean’ languages like – Pascal – derived from Algol-W as a concise

powerful teaching language– C – again, an Algol derivative, this time aimed at

being a small clean system implementation language (greatly helped by the success of Unix)

Gary Marsden Slide 26University of Cape Town

The eighties

As large programming tasks became common, language design was driven to manage complexity

The eighties also saw a renewed interest in alternative programming paradigms, resulting in languages like– Prolog– Scheme– SQL

Gary Marsden Slide 27University of Cape Town

ADA

Ada was commissioned by the US DoD. All DoD projects now need to be written in Ada.

Compilers need to be accredited – an expensive process involving men in dark suits with libraries of test programs

Implemented abstract data type mechanism, called a ‘package’

Had exception handling and concurrent execution

Gary Marsden Slide 28University of Cape Town

Object orientation

ADT languages eventually gave way to object-oriented languages

The first of these was really SmallTalk, designed by Alan Kay at XEROX PARC

These ideas were developed in two ways– Shoehorned into existing languages – C++,

Objective-C– Developed into elegant but incredibly inefficient

languages – Eiffel

Gary Marsden Slide 29University of Cape Town

Generations

You will hear languages referred to as being from a particular “generation”

This is an inexact classification, but is roughly as follows– First generation languages are assembly langauges– Second generation are really COBOL and FORTRAN1,

which have no high level abstraction– Third generation are languages like C, Pascal, C++

etc.– Fifth generation languages are very high level,

basically Prolog– I doubt there will be a widely accepted 6th generation

Gary Marsden Slide 30University of Cape Town

Fourth generation

Missing from the last slide is the fourth generation of languages

This group includes all high level application languages. Examples include– macro languages– SQL

There has been almost no academic study of this generation, as the language design people see them as a subset of 3GL’s

They are worth studying from a usability aspect

Gary Marsden Slide 31University of Cape Town