The History and Philosophy of Programming Language

Harry Halpin, <hhalpin -(a)- ibiblio.org>

http://www.ibiblio.org/hhalpin/homepage/presentations/programmingtalk/

Real Programmers program in binary

Interface Seminar, Duke Univ., Nov. 1st 2006

Only Cybernetics can save us

And what takes the placer of philosophy?

M. Heidegger
Cybernetics
Martin Heidegger, "Only a God can save us"

Prehistory of Computing: Leibniz and the Monads

G. Leibniz

...a general method in which all truths of reason would be reduced to a kind of calculation. At the same time, this would be a sort of universal language or script, but infinitely different from all those imagined previously, because its symbols and words would direct the reason, and errors - except those of fact - would be mere mistakes in calculation...
Gottfried Leibniz, The Monadology

Binary: zero and one could be associated with the presence or absence of a monad.

The First Computer: Babbage and Lovelace

The first computer was not digital at all...but the analog Difference Engine, later the Analytic Engine (1822), feating sequential control, branching, and looping! A. Lovelace

Ada Lovelace wrote the first known program to calculate the Bernoulli Numbers.

Engine

And therefore is considered by most to be the first programmer, despite the fact the Analytical Engine never was completed.

The beginnings of logic


frege

Gottlieb Frege in his Grundlagen der Arithemetik sought to encode all of arithmetic, and thus all of mathematics, into what became known as first-order predicate logic

Russell

What is the set of all sets that does not contain itself?

or barber who shaves everyone who does not shave himself, and no one else?

Such a barber does not exist, but does such a set not exist?

Hilbert's Programme and the Entscheidungsproblem

Called for a formalization of all mathematics using "finitary" methods, along with a proof of consistency.

Hilbert

Yet how could we tell what could be "computed" by a human using finite methods?

If this was true, we could prove all mathematics true.

If it's false, then there are true things that cannot be proven.

Turing's Solution:

An Web Applet Example

The Halting Problem

With this definition, Turing had invented a mathematical model of the computer. Furthermore, he proved that a Turing machine can never decide whether another Turing machine will halt given another Turing machine as input. Turing

First-order logic is undecidable, or Turing-Complete. As are many other things...

  1. There are things that are true that can never be proved.
  2. There are things that are false that can never be disproved.
In Manchester, they built a mechanical Turing Machine as did others (ABC, Z1, Colossus, ENIAC).

Grace Hopper and Imperative Programming

Under the tutelage of Von Neumann, computers were programmed by directly manipulating via unreadable machine code their registers (states) and giving those commands that were pre-wired into the hardware. Hopper

The first modern programming language was a series of easy to remember mnemonics for machine code, invented by Grace Hopper.

This style of coding developed into many programming languages (FORTRAN, COBOL, ALGOL).

Imperative Programming

Early programming languages mimicked the behavior of the Turing Machine, with state being stored by variables in memory, commands being given to the machine via in a sequential order. These languages are called imperative.

An Example in C, called imperative or procedural programming:


main()
{ 
    char array[12] = "hello, world\n"; 
    printf("%s", array); 
    return 0; 
} 

Are all computers the same?

Alonzo Church invented a better way - the lambda calculus, a meta-logical language used to manipulate logical symbols.

Church

The Church-Turing Hypothesis: Turing Machines and the Lambda Calculus are equivalent, therefore all computers have the same level of power.

lambda

Chomsky and Power

Chomksy

Noam Chomsky refined the notion of "power" in connection with Turing Machines and connected it to human grammar via the Chomksy Hierarchy:

Chomksy Hierarchy

Natural Science

nature as beauty

Computer Science

computer science is ugly

Symbolic and Functional Computing

Von Neumann and others though programs were just number-crunchers John McCarthy

But Newell and Simon articulated that programs didn't manipulate numbers at all, but manipulated symbols!

What does 10 mean? The number "ten" in decimal, or the number "three" in binary?

This led McCarthy, while attempting to make a mathematical notation for computer programs based on Church's lambda calculus.

LISP (List ProceSsing Language)

Everything is a function, even numbers. Functions manipulate lists of symbols.


(defun hello-world (greeting) (print greeting))

(hello-world "Hello, World!")

Functions do not have variables like they do in imperative languages that maintain arbitrary state

State is kept entirely in the functions, which can then be called in any order.

The pure language was supposed to be based on functions, but it's most important components - such as lambda expressions, quotes, and conds, where not functions at all, and instead were called special forms.
Alan Kay, Early History of Smalltalk

Alan Kay and Object-Oriented Programming

Imperative programming leads to "spaghetti-code" that is nearly impossible to maintain.

Alan Kay Functional programming is hard to read, and often described as unnatural to people who like to think in terms of modelling or "step-by-step" algorithms.

Alan Kay, as a critique of LISP, invented Smalltalk, the first object-oriented programming language.

What are Objects?

Objects are a kind of mapping whose values are its behaviors
Alan Kay, Early History of Smalltalk

Objects combine the variables that contain the state of the object as well as a finite set of functions that modify these variables.

Objects are black-boxes to hide complexity, since only an object can correctly navigate its state.

Java Examples

We were after the C++ programmers. We managed to drag a lot of them about halfway to Lisp. Aren't you happy?
Guy Steele
public class HelloWorld {
      public static void main(String args[]) {
         System.out.println("Hello World!");
      }
   }

Planning could then be done informally English, and these notes would later serve as commentaries and guides to the writing of the actual code.
Alan Kay, The Early History of Smalltalk

Classes and Instances

Like tokens and types in philosophy...
public class Bicycle {
    public int gear;
    public int speed;

    public Bicycle(int startSpeed, int startGear) {
        gear = startGear;
        speed = startSpeed;
    }

    public void setGear(int newValue) {
        gear = newValue;
    }

    public void applyBrake(int decrement) {
        speed -= decrement;
    }
	
    public void speedUp(int increment) {
        speed += increment;
    }
    	
}

Bicycle my_red_bike(10, 3) = new Bicycle;

Inheritance and Polymorphism

Inheritance is extending an existing class with new variables and functions.

public class MountainBike extends Bicycle {
	
    public int seatHeight;

    public MountainBike(int startHeight, int startSpeed, int startGear) {
        super(startSpeed, startGear);
        seatHeight = startHeight;
    }	
	
    public void setHeight(int newValue) {
        seatHeight = newValue;
    }	

}

MountainBike my_blue_bike = new MountainBike(12,11,5)

Polymorphism is the ability to use the functions an object inherited on an object itself. Since objects that extend simpler objects contain all their variables and functions, this is safe.

Smalltalk and the GUI

In Smalltalk, everything is an object. There are no types, and objects communicate through sending messages to each other.
   Transcript show: 'Hello, world!'.
Smalltalk

Late Binding

  1. Programmers write code
  2. Then it is ran through a compiler, turning to machine code
  3. The computer executes the machine code, running the program.
  4. Early Binding must bind all the objects (data, functions,..) to the program at compile-time.

    Late Binding must bind all the objects to the program at run-time.

    Code may be ran through interpreters that executes the code on a virtual machine, a machine that simulates another, often simpler, machine in software, to escape the arbitrariness of the hardware.

The Web and the Open World

Programming languages for the most part have not kept up with the Web, a universal information space.

Important data may not be local and easily accessible, and the programming environment is open-ended (virtually non-finite) and diverse!

New programming languages have arisen that make programming easier by building in fundamental Web constructs: Perl, Python, Ruby...

Javascript that powers the Web 2.0 includes the very idea of client-side programming, while PHP allows server-side code to be put in web pages.

Most of these share characteristics with object-oriented programming, although none are peer-to-peer and truly have late binding.

Programming Languages?

What programming language would aliens use?

Aliens Attack White House!

The Answer

Aliens Program in C!

Aliens Program in C

Programming Languages as Philosophy

The programmer, like the poet, works only slightly removed from pure thought-stuff. He builds his castles in the air, from air, creating by exertion of the imagination. Few media of creation are so flexible, so easy to polish and rework, so readily capable of realizing grand conceptual structures.
Frederick P. Brooks

Programming Languages as Applied Metaphysics: Is there a fundamental ontology out there that our programming languages work incarnate or model?

Programming Languages as Experimental Epistemology: Do programming languages model ways of knowing the world? In which case, which are the most easy-to-learn and effective?

Another answer...

What programming language would children use?

Children