<<

HISTORYOFPROGRAMMINGLANGUAGES

CS 403: A Brief (and Pretty Incomplete) History of “Prehistory” Programming Languages The 1940s: von Neumann and Zuse The 1950s: The first programming language The 1960s: An explosion in programming languages Stefan D. Bruda The 1970s: Simplicity, abstraction, study The 1980s: Consolidation and new directions The 1990s: The explosion of the World Wide Web Fall 2021 The 21st century

CS 403: A Brief (and Pretty Incomplete) History of Programming Languages (S. D. Bruda) Fall 2021 1 / 21

PREHYSTORY WRITTEN LANGUAGE TO DESCRIBE COMPUTATIONAL PROCEDURES Cuneiform writing used in the Babylon, founded by Hammurabi around 1790 BC A cistern. poems, stories, contracts, records, astronomy, math The length equals the height. A certain volume of dirt has been excavated. The cross-sectional area plus this volume comes to 110. The length is 30. What is the width? Famous Babylonian math You should multiply the length, 30, by . . . tablet (Plimpton 322) — Translation by Donald Knuth involving Pythagorean triples, a2 + b2 = c2 – with No variables a mistake! (or bug) Instead, numbers serve as a running example of the procedure being described “This is the procedure” Weird math (base 60!) Programming is among the earliest uses to which written language was two characters to express a (base-60) digit put decimal point not specified (must be figured out from context) Programming languages design has tried to get as close to that as possible from the very beginning. . .

CS 403: A Brief (and Pretty Incomplete) History of Programming Languages (S. D. Bruda) Fall 2021 2 / 21 CS 403: A Brief (and Pretty Incomplete) History of Programming Languages (S. D. Bruda) Fall 2021 3 / 21 ALGORITHMS THE FIRST PROGRAMMING ENVIRONMENTS

Abu¯ ’Abdallah¯ Muh. ammad ibn Mus¯ a¯ al-Khwarizm¯ ¯ı, or Mohammed Al-Khorezmi for short (Baghdad, 780–850 BC) Jacquard loom (early 1800s) translated One little book: “The Compendious Book on Calculation by Completion and card patterns into cloth designs Balancing” Compilation and extension of known rules for solving quadratic equations and Charles Babbage’s Analytical Engine other problems (1830s & 40s) Used as a mathematics text in Europe for eight hundred years First programmer: Augusta Ada King, The book is considered the foundation of algebra Countess of Lovelace (today commonly Invention of the notions of algorithms and data structures known as Ada Lovelace) Other early algorithms: The engine can arrange and combine its numerical quantities exactly as if they Euclid (300 BC): an algorithm for the GCD of two numbers were letters or any other general symbols; Eratosthenes (about same ): one of the most efficient algorithms for and in fact might bring out its results in al- finding small primes (the sieve of Eratosthenes) gebraic notation, were provision made. Alexander de Villa Dei (1220 AD): Canto de Algorismo = algorithms in Latin verse Programs were punched cards containing data and operations Natural language (even poetry!) plus math rather than programming languages

CS 403: A Brief (and Pretty Incomplete) History of Programming Languages (S. D. Bruda) Fall 2021 4 / 21 CS 403: A Brief (and Pretty Incomplete) History of Programming Languages (S. D. Bruda) Fall 2021 5 / 21

THE 1940S: VON NEUMANNAND ZUSE THE FIRST COMPUTER BUG!

Harvard Mark I (1943) – Howard Aiken (IBM), Grace Hopper (Navy) first electro-mechanical computer → Harvard Mark II: First computer bug ENIAC (1946) – Presper Eckert, John Mauchly (U. Penn.) First → electronic computer Programming was manual, with switches and cables John von Neumann led a team that built computers with stored programs and a central processor (as we know them today) Konrad Zuse designed the first programming language as we know it (Plankalkul = program calculus) In Germany, in isolation because of the war; work finally published in 1972 Advanced data features: floating point, arrays, records Invariants for correctness Rather cumbersome notation 5 B A ∗ ⇒ A[7] := 5 B[6] V 6 7 (subscripts) × → S 1.n 1.n (data types)

Never implemented

CS 403: A Brief (and Pretty Incomplete) History of Programming Languages (S. D. Bruda) Fall 2021 6 / 21 CS 403: A Brief (and Pretty Incomplete) History of Programming Languages (S. D. Bruda) Fall 2021 7 / 21 THE 1950S:THE FIRST PROGRAMMING LANGUAGES FORTRAN EXAMPLE

FORTRAN (1957, John Backus) IMPLICIT INTEGER (A-Z) FORmula TRANslator – designed for scientific programming DIMENSION ORD(N),POPLST(2,20) Many new features over time: FORTRAN II, FORTRAN IV, FORTRAN 66, INTEGER X,XX,Z,ZZ,Y FORTRAN 77 (structured programs, char’s), Fortran 90 (arrays, modules), INTEGER A(N) Fortran 2003 (objects), Fortran 2008 (concurrent programming) NDEEP=0 Very efficient compilation into fast machine code U1=N COBOL (1960, Grace Hopper) L1=1 mathematical programs should be written in mathematical notation, DO 1 I=1,N data processing programs should be written in English statements — 1 ORD(I)=I G. Hopper, 1953 2 IF (U1.LE.L1) RETURN 3 L=L1 Committee sponsored by US Department of Defence U=U1 Biggest contribution was the idea that programs should be written in a way 4 P=L that is easily understood Q=U Adopted widely by businesses for record-keeping applications Record structure, separation of data from execution part, versatile formatting X=A(ORD(P)) of output using “pictures” Z=A(ORD(Q)) ANSI standards (1968, 1974, 1985) IF (X.LE.Z) GO TO 5 .... 5

CS 403: A Brief (and Pretty Incomplete) History of Programming Languages (S. D. Bruda) Fall 2021 8 / 21 CS 403: A Brief (and Pretty Incomplete) History of Programming Languages (S. D. Bruda) Fall 2021 9 / 21

COBOL EXAMPLE THE 1950S:THE FIRST LANGUAGES (CONT’D)

ENVIRONMENT DIVISION. CONFIGURATION SECTION. Algol 60 SOURCE-COMPUTER. IBM-4381. General, expressive language; most current imperatives are derivatives OBJECT-COMPUTER. IBM-4381. Introduced many modern concepts structured programming reserved keywords type declarations DATA DIVISION. recursion stack dynamic arrays call-by-value WORKING-STORAGE SECTION. user defined types free-format 01 INPUT-FIELD. Stack-based run time environment 05 INPUT-VALUE PIC 99 VALUE ZERO. Great success and also great failure (ahead of its time, too complex, lack of 01 CALCULATION-FIELD. I/O, lack of support from IBM) entrenchment of Fortran → 05 SUM-VALUE PIC 9(03) VALUE ZERO. LISP (John McCarthy, MIT) 05 AVERAGE-VALUE PIC 9(03)V99 VALUE ZERO. LISt Processing the main data structure is the (singly linked) list 01 OUTPUT-FIELD. → Untyped, messy language, but good for problems we solve by trial and error 05 EDIT-FIELD PIC ZZ9.99 VALUE ZERO. (quick prototyping) used in many AI applications → Historically inefficient on Von Neumann machines PROCEDURE DIVISION. Main processing unit: the recursive function influenced the modern 1000-MAIN. → functional languages such as ML, Miranda, Haskell PERFORM 2000-INPUT-ADD 10 TIMES. Contemporary variants include Common Lisp, Scheme, Emacs Lisp DIVIDE 10 INTO SUM-VALUE GIVING AVERAGE-VALUE. 2000-INPUT-ADD. ...

CS 403: A Brief (and Pretty Incomplete) History of Programming Languages (S. D. Bruda) Fall 2021 10 / 21 CS 403: A Brief (and Pretty Incomplete) History of Programming Languages (S. D. Bruda) Fall 2021 11 / 21 ALGOLEXAMPLE LISPEXAMPLE

procedure Absmax(a) Size:(n, m) Result:(y) Subscripts:(i, k); value n, m; (defun mapcar (fun list) array a; "Applies FUN on every element of LIST and returns the integer n, m, i, k; list of results (iterative version)." real y; (let ((results nil)) comment The absolute greatest element of the matrix a, of size (dolist (x list) n by m is transferred to y, and the subscripts of this element (setq results (cons (apply #’fun x) results))) to i and k; (reverse results))) begin integer p, q; y := 0; i := k := 1; (defun mapcar (fun list) for p:=1 step 1 until n do "Applies FUN on every element of LIST and returns the for q:=1 step 1 until m do list of results (recursive version)." if abs(a[p, q]) > y then (cons (apply #’fun (car list)) begin y := abs(a[p, q]); (mapcar fun (cdr list)))) i := p; k := q end end Absmax

CS 403: A Brief (and Pretty Incomplete) History of Programming Languages (S. D. Bruda) Fall 2021 12 / 21 CS 403: A Brief (and Pretty Incomplete) History of Programming Languages (S. D. Bruda) Fall 2021 13 / 21

THE 1960S:ANEXPLOSIONINLANGUAGES THE 1970S:SIMPLICITY, ABSTRACTION, STUDY

Hundreds of languages were developed Algol-W then Pascal (Nicklaus Wirth and C.A.R.Hoare) small, simple, → efficient (reaction against the 60s), ideal for teaching C (Dennis Ritchie) PL/1 (1964) Constructed as a portable assembler to build for various architectures Combined features of FORTRAN, COBOL, Algol 60 and ! But also has modern features (structured programming, data structures, etc.) Translators were slow, huge, and unreliable The primary API for Unix (Mac OS, Linux, etc.) is still C! Some say it was ahead of its time. . . Euclid (University of Toronto, 1977) Algol 68 still ahead of its time! Main goal formal program verification → → Simula (or what would be called today Object-oriented Algol) extends Pascal to include abstract data types BASIC Scheme (1978, MIT) simplified, cleaner Lisp → etc.

CS 403: A Brief (and Pretty Incomplete) History of Programming Languages (S. D. Bruda) Fall 2021 14 / 21 CS 403: A Brief (and Pretty Incomplete) History of Programming Languages (S. D. Bruda) Fall 2021 15 / 21 C EXAMPLE THE 1980S:CONSOLIDATION & NEWDIRECTIONS

#include main(t,_,a) char*a; {return!0

1990s Computing devices are ubiquitous, and so is the Internet and Web Java eliminate the non-object-oriented features of C++ → C and C++ are the most widely used system programming languages Haskell purely functional programming language → Java had peaked. . . and then came Android quicksort [] = [] quicksort (x:xs) = quicksort [y|x <- xs, y < x] ++ [x] ++ Most students learn C / C++ or Java quicksort [y|x <- xs, y >= x] Web 2.0 programming (PHP, etc.) 2000s COBOL and Java are used for business applications Python multi-paradigm language (procedural, object-oriented, functional, → Fortran is the main language on supercomputers etc.) Languages for the Web We already have Object-Oriented Fortran! C++ is growing Java applets Languages within Web pages (PHP, server-side includes) Several non-mainstream (but cleaner) languages rising (Ruby, Python, Emphasis on cross-platform development Haskell) but knows what the future has in store → Develop on PC, run on cell phones, game consoles, and toasters Object-Oriented COBOL?

CS 403: A Brief (and Pretty Incomplete) History of Programming Languages (S. D. Bruda) Fall 2021 18 / 21 CS 403: A Brief (and Pretty Incomplete) History of Programming Languages (S. D. Bruda) Fall 2021 19 / 21 STRANGELANGUAGES CHRONOLOGY

Strange languages definitely exist Fortran Case in point: Brainf**k Lisp 1960 Algol 60 COBOL APL A Brainf**k program has an implicit byte pointer, called “the pointer”, which is Snobol 4 free to move around within an array of 30,000 bytes, initially all set to zero Simula PL/1 The pointer is initialized to point to the beginning of this array

The Brainf**k programming language consists of eight commands, each of Algol 68 which is represented as a single character 1970 Pascal > Increment the pointer Smalltalk Prolog < Decrement the pointer Clu C + Increment the byte at the pointer Scheme - Decrement the byte at the pointer ML Ada . Output the byte at the pointer ICON 1980 Modula 2 , Input a byte and store it in the byte at the pointer Miranda C++ [ Jump past the matching ] if the byte at the pointer is zero Eiffel ] Jump to the matching [ Oberon >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..++ Haskell

+.[-]>++++++++[<++++>-] <.#>+++++++++++[<+++++>-]<.>+++ 1990 +++++[<+++>-]<.+++.------.------.[-]>++++++++ [ <++++ >-]<+.[-]++++++++++. Java

CS 403: A Brief (and Pretty Incomplete) History of Programming Languages (S. D. Bruda) Fall 2021 20 / 21 CS 403: A Brief (and Pretty Incomplete) History of Programming Languages (S. D. Bruda) Fall 2021 21 / 21