#use wml::tmpl::main title="Programming" PAGE=programming SUBPAGE=overview

<H1>Computer Programming</H1>
<P>
All <A href="http://en.wikipedia.org/wiki/Computers">computers</A> operate by
following machine language programs, a long sequence of instructions called
<foldoc machine code> that is addressed to the hardware of the computer and is
written in <foldoc binary> notation, which uses only the digits 1 and 0.
First-generation languages, called machine languages, required the writing
of long strings of binary numbers to represent such operations as
&#147;add,&#148; &#147;subtract,&#148; and &#147;compare.&#148;
Later improvements allowed <foldoc octal>, decimal, or <foldoc hexadecimal>
representation of the binary strings.</P>
<P>
Because writing programs in machine language is impractical (it is tedious and
error prone), symbolic, or assembly, languages&#151;second-generation
languages&#151;were introduced in the early 1950s. They use simple
<foldoc mnemonics> such as A for &#147;add&#148; or M for &#147;multiply,&#148;
which are translated into machine language by a computer program called an
<foldoc assembler>. The assembler then turns that program into a machine
language program.
An extension of such a language is the macro instruction, a mnemonic (such
as &#147;READ&#148;) for which the assembler substitutes a series of simpler
mnemonics. The resulting machine language programs, however, are specific to
one type of computer and will usually not run on a computer with a different
type of central processing unit (<foldoc CPU>).</P>

<P>
The lack of <foldoc portability> between different computers led to the
development of high-level languages&#151;so called because they permitted a
programmer to ignore many low-level details of the computer's hardware.
Further, it was recognized that the closer the <A href="http://en.wikipedia.org/wiki/Syntax#Syntax_in_computer_science">syntax</A>, rules, and mnemonics
of the programming language could be to &#147;natural language&#148; the less
likely it became that the programmer would inadvertently introduce errors
(called &#147;<A href="http://catb.org/jargon/html/B/bug.html">bug</A>s&#148;) into the program. Hence, in the mid-1950s a third
generation of languages came into use. These algorithmic, or <foldoc procedural>,
languages are
designed for solving a particular type of problem. Unlike machine or symbolic
languages, they vary little between computers. They must be translated into
machine code by a program called a <foldoc compiler> or <foldoc interpreter>.</P>
<P>
Early computers were used almost exclusively by <A href="http://en.wikipedia.org/wiki/Scientists">scientists</A>, and the first
high-level language, <A href="http://en.wikipedia.org/wiki/FORTRAN">FORTRAN</A> [<I>FOR</I>mula <I>TRAN</I>slation], was
developed for scientific and engineering applications about 1956
by John Backus at the IBM Corp.
A program that handled <foldoc recursive> algorithms better, <A href="http://en.wikipedia.org/wiki/Lisp">LISP</A> [<I>LIS</I>t
<I>P</I>rocessing], was developed by John McCarthy at the
<A href="http://www.mit.edu/">Massachusetts Institute of Technology</A> in the
early 1950s; implemented in 1959, it has become the standard
language for the <A href="http://en.wikipedia.org/wiki/Artificial_intelligence">artificial intelligence</A> community.
<A href="http://en.wikipedia.org/wiki/COBOL">COBOL</A> [<I>CO</I>mmon <I>B</I>usiness <I>O</I>riented <I>L</I>anguage],
the first language intended for commercial applications, is still widely used;
it was developed by a committee of computer manufacturers and users
under the leadership of Grace Hopper, a U.S. Navy programmer, in 1959.
<A href="http://en.wikipedia.org/wiki/ALGOL">ALGOL</A> [<I>ALGO</I>rithmic
<I>L</I>anguage], developed in Europe about 1958,
is used primarily in mathematics and science, as is
<A href="http://www.acm.org/sigapl/">APL</A> [<I>A P</I>rogramming
<I>L</I>anguage], published in the United States in 1962 by Kenneth Iverson.
PL/1 [<I>P</I>rogramming <I>L</I>anguage <I>1</I>], developed in the late
1960s by the IBM Corp., is designed for both business and scientific use.</P>
<P>
Ada was designed during the early 1980s in France by a
team headed by Jean Ichbiah, funded by the US Department of Defense. It
was designed for embedded real time systems and to fascilitate code
reusability.
Bernd Krieg-Bruckner designed the module system. In terms of its general
features, Ada is in the ALGOL family. It is named after
<A href="http://www.agnesscott.edu/lriddle/women/love.htm">Lady Ada Augusta Lovelace</A>, the world's first programmer, and daughter of the
great English poet Lord Byron; she worked closely with
<A href="http://ei.cs.vt.edu/~history/Babbage.html">Charles Babbage</A>, and
wrote programs for his <A href="http://www.fourmilab.to/babbage/contents.html">gear-driven
mechanical computers</A>.
<P>
<A href="http://en.wikipedia.org/wiki/BASIC_programming_language">BASIC</A> [<I>B</I>eginner's <I>A</I>ll-purpose <I>S</I>ymbolic <I>I</I>nstruction
<I>C</I>ode] was developed by two Dartmouth College professors, John Kemeny
and Thomas Kurtz, as a teaching tool for undergraduates (1966); it
subsequently became the primary language of the personal computer revolution.
In 1971, Swiss professor Nicholas Wirth developed a more structured language
for teaching that he named Pascal (for French mathematician Blaise Pascal,
who built the first successful mechanical calculator). Modula 2, a Pascal-like
language for commercial and mathematical applications, was introduced by Wirth
in 1982. Ten years before that, to implement the UNIX operating system, Dennis
Ritchie of Bell Laboratories produced a language that he called C; along with
its extensions, called C++, developed by Bjarne Stroustrup of Bell
Laboratories, it has perhaps become the most widely used general-purpose
language among professional programmers.
<P>
In 1975, Guy Lewis Steele Jr. and Gerald Jay Sussman developted
<A href="$(ROOT)/scheme.html">Scheme</A> at <a href="http://www.mit.edu/">MIT</A>,
a dialect of Lisp which is especially known for its simplicity.
<P>
In 1991, <A href="http://www.sun.com/">Sun Microsystems</A> initiated
a project which would later emerged as Java.  Its first implementation, Oak,
was written by James Gosling using C. In autumn 1993 Arthur Van Hoff joins the
language team and implements one year later the first Java compiler written
in Java.
Java is an object-oriented language similar to C++ but simplified to eliminate
features that are prone to programming errors. Java was developed specifically
as a network-oriented language, for writing programs that can be safely
downloaded through the Internet and immediately run without fear of
<A href="http://en.wikipedia.org/wiki/Computer_virus">computer virus</A>es.
This is achieved by not running a Java program on the host
CPU directly, instead the program is executed in a so called virtual machine,
which offers common facilities to all Java applications, and therefore
offering a certain degree of portability.
However, if you think of it for a while, you realize this is what an
<A href="http://en.wikipedia.org/wiki/Operating_system">operating system</A>
is already supposed to do for <A href="http://en.wikipedia.org/wiki/Application_software">applications</A> running on top of it,
so the concept remains questionable.
For more details, see 
<UL>
<LI><A href="http://www.ils.unc.edu/blaze/java/javahist.html">this account of
the history of Java</A> based on an outline put together by Patrick Naughton,
co-author ofthe HotJava browser, OR
<LI><A href="http://ei.cs.vt.edu/~wwwbtb/book/chap1/java_hist.html">History of
Java</A> from "<A href="http://ei.cs.vt.edu/~wwwbtb/book/index.html">World
Wide Web: Beyond The Basics</A>"
</UL>
<P>
Fourth-generation languages are nonprocedural&#151;they specify what is to be
accomplished without describing how. The first one,
<A href="$(ROOT)/forth.html">FORTH</A>, developed in 1970
by American astronomer <A href="http://www.colorforth.com/">Charles Moore</A>,
is used in scientific and industrial control applications. Most
fourth-generation languages are written for specific purposes.
Fifth-generation languages, which are still in their
infancy, are an outgrowth of artificial intelligence research.
<A href="http://en.wikipedia.org/wiki/Prolog">PROLOG</A> [<I>PRO</I>gramming
<I>LOG</I>ic], developed by French computer scientist <A href="http://en.wikipedia.org/wiki/Alain_Colmerauer">Alain Colmerauer</A> and logician Philippe Roussel in the early 1970s,
is useful for programming logical processes and making <A href="http://en.wikipedia.org/wiki/Natural_deduction">deduction</A>s
automatically.</P>

<P>
A fundamentally different strain of programming languages is the family of
functional programming languages.
<A href="http://en.wikipedia.org/wiki/Alonzo_Church">Alonzo Church</A>
developed the Lambda-calculus as an attempt to provide a basis
for mathematics in 1930.
In lambda calculus, every expression stands for a function with a single
argument; the argument of the function is in turn a function with a single
argument, and the value of the function is another function with a single
argument. Functions are anonymously defined by a lambda expression which
expresses the function's action on its argument. For instance, the "add-two"
function <em>f</em>(<em>x</em>) = <em>x</em> + 2 would be expressed in lambda
calculus as &lambda; <em>x</em>. <em>x</em> + 2
and the number <em>f</em>(3) would be written as
(&lambda; <em>x</em>. <em>x</em> + 2) 3.
Function application is left associative:
<em>f</em> <em>x</em> <em>y</em> = (<em>f</em> <em>x</em>) <em>y</em>.
Consider the function which takes a function as argument and applies it to the
argument 3: &lambda; <em>x</em>. <em>x</em> 3. This latter function could be
applied to our earlier "add-2" function as follows:
(&lambda; <em>x</em>. <em>x</em> 3) (&lambda; <em>x</em>. <em>x</em>+2).
It is clear that the three expressions
(&lambda; <em>x</em>. <em>x</em> 3) (&lambda; <em>x</em>. <em>x</em>+2)
&nbsp;&nbsp; and &nbsp;&nbsp;
(&lambda; <em>x</em>. <em>x</em> + 2) 3 &nbsp;&nbsp; and &nbsp;&nbsp; 3 + 2
are equivalent. A function of two variables is expressed in lambda
calculus as a function of one argument which returns a function of one
argument.
For instance, the function <em>f</em>(<em>x</em>, <em>y</em>) = <em>x</em> -
<em>y</em> would be written as &lambda; <em>x</em>. &lambda; <em>y</em>. <em>x</em> - <em>y</em>.

Formally, we start with a <a href="http://www.wikipedia.org/wiki/Countable">countably infinite</a>
<a href="http://www.wikipedia.org/wiki/Set">set</a> of identifiers, say
{a, b, c, ..., x, y, z, x<sub>1</sub>, x<sub>2</sub>, ...}. The set of all
lambda expressions can then be described by the following
<a href="http://www.wikipedia.org/wiki/Context-free_grammar">context-free
grammar</a> in <a href="http://www.wikipedia.org/wiki/Backus-Naur_form">BNF</a>:
<ol><li>&lt;expr&gt; &rarr; &lt;identifier&gt;
</li><li>&lt;expr&gt; &rarr; (&lambda; &lt;identifier&gt; . &lt;expr&gt;)
</li><li>&lt;expr&gt; &rarr; (&lt;expr&gt; &lt;expr&gt;)
</li></ol>
The pure Lambda-calculus has been proved inconsistent  as  a logical theory.
Some type systems have been added to it in order to remedy this inconsistency.
<P>
In 1965, P. Landin proposed the ISWIM [<i>I</i>f You <i>S</i>ee <i>W</i>hat
<i>I</i> <i>M</i>ean] language, which is the precursor of languages of the
ML family.
J. Backus introduced <A href="http://www.stanford.edu/class/cs242/readings/backus.pdf">FP</A> in 1978:  a language of combinators and a framework 
in which it is possible to reason about programs.
The main particularity of FP programs is that they have no variable names.
Also in 1978, R. Milner proposes a language called ML [<i>M</i>eta
<i>L</i>anguage], intended to be the metalanguage of the LCF proof assistant
(i.e. the language used to program the search of proofs).  This  language
is inspired by ISWIM (close to Lambda-calculus) and possesses an
original type system.
It was implemented by a kind of interpreter written in Lisp by
Mike Gordon, Robin Milner and Christopher Wadsworth.
In 1980-1981, the <EM> Formel </EM> project at
<A HREF="http://www.inria.fr/">INRIA</A>
became interested in ML.
In order to be able to use the LCF proof assistant on the various
systems the Formel project was using at that time (Multics, Berkeley Unix on Vax,
Symbolics), G&eacute;rard Huet decided to make the ML implementation
compatible with various Lisp compilers (MacLisp, FranzLisp, LeLisp, ZetaLisp).
This implementations improved performance by adding a compiler.
Around 1984, several other paralell developments took place:
<UL>
<LI>
Luca Cardelli developed at Edinburgh a much faster implementation of ML using
his <EM>Functional Abstract Machine (FAM)</EM>.
He also designed his own version of the language which was known at
that time as Cardelli's ML.
<LI>Robin Milner proposed a new definition
of ML in order to avoid divergence between various implementations.
He defined the core Standard ML language.
<LI>
Pierre-Louis Curien developed a calculus of categorical combinators and a
correspondance between
lambda-calculus and categorical combinators which, could be seen as a
compiling technique for ML. Indeed, it was quite close to the original
implementation technique of Edinburgh ML but could be described, proved
correct and optimized in a simple way.  This led to the definition of the
Categorical Abstract machine (CAM).
</UL>
This led to a new implementation of ML based on the CAM.  However,
it was not based on SML, instead, a new dialect was born, Caml [Categorical Abstract Machine Language].
Development continued until 1994 under the Formel project and
is currently continuing in project 
<A HREF="http://www.inria.fr/Equipes/CRISTAL-eng.html">Cristal</A>.
A more detailed and complete <A href="http://www.pps.jussieu.fr/~cousinea/Caml/caml_history.html">history of Caml</A> is also available.
<P>
David Turner proposed the
<A href="http://www.engin.umd.umich.edu/CIS/course.des/cis400/miranda/miranda.html">Miranda</A>
programming language in 1985, which resulted in a number of offspring.
All languages in the Miranda family of programming languages use
<foldoc lazy evaluation> (i.e. the argument of a function is evaluated if and
when the function needs its value---arguments are passed unevaluated to
functions). They also use Milner's type system.
Languages belonging to the Miranda family find their origin in the SASL
language (1976) developed by D. Turner. SASL and  its successors (KRC 1981,
Miranda 1985 and Haskell 1990) use sets of mutually recursive equations as
programs. These equations are written in a script (collection of declarations)
and the user may evaluate expressions using values defined in this script.

<P>
This variety of functional programming languages led to some confusion and
although each one has its specific features and advantages the need for a
standard emerged. At the end of this process a brand-new programming language
arose: Haskell. Haskell was an attempt to create "the" standard, non-strict,
higher order functional language to achieve a consistent base for research
(e.g. by providing uniform identifiers for common functions). It contains
many of the features from earlier functional languages, such as higher order
functions, type inference, and non-strict semantics. A novel invention in
Haskell is type classes, a structured form of overloading that is reminiscent
of how method names are overloaded in object-oriented languages.
The first version of Haskell (1.0) was defined in 1990.

<P>
If all this information has just added to the confusion and increased the 
urgency level of the question "And which one is the best?", I
suggest you read
<A href="http://www.cs.ucsd.edu/users/goguen/papers/compl.html">An Essay
on Comparative Programming Linguistics</A>. The short answer to the question
is simply "There is no general answer to that question."

<p>I'm interested in computer programming since I got my first computer.
That was at the age of 12, and I started out with MS-DOS qbasic.  Later on, I
moved to Borland Pascal, which was also the language I was taught in school.</p>
<p>When I moved to Linux I started to learn all those various scripting languages like Perl and Python. After I started to dig into the internals of Emacs, I discovered Emacs Lisp, and the wonderful world of functional programming languages.  So I also had a look at Common Lisp, Guile Scheme and Haskell.</p>
<p>My favourites today are Emacs Lisp, C and Perl, in that order.</p>

