Programming Languages
Alan Perlis once said:
"A language that doesn't affect the way you think
about programming, is not worth knowing".
Here are some opinions and facts about a selection of programming
languages by Dr Mark Utting (
a
lecturer in the
Department of
Computer Science at
The University
of Waikato).
The
Open Directory Project has lots of
programming
language information.
For examples of programming in 200+ different languages,
check out the
99
Bottles of Beer page. The Dylan version is nice, but make sure
you check out all the C++ versions too! The template version is amazing!
Another overview of programming and web languages is
on
test-king.com.
Object-Oriented Languages
The
Cetus Team maintains a large
collection of links about most object-oriented languages.
Let us start with some lesser-known, but more novel,
object-oriented languages, then work down to the well-known mainstream ones.
One of my favourite object-oriented languages is
Cecil,
by Craig Chambers.
It is a multiple-dispatch language that supports both exploratory untyped
programming and large-scale statically-typed programming.
It includes some new and very expressive ideas (see the paper
"Predicate
Dispatching: A Unified Theory of Dispatch" by
Michael Ernst, Craig Kaplan and Craig Chambers).
Cecil is quite similar to the theoretical language that I developed in my
PhD thesis.
An equally nice language is
Dylan.
Like Cecil, Dylan is a safe, strongly-typed, pure object-oriented language
that supports multiple dispatch, modules, first-class functions etc.
Dylan was originally designed by Andrew Shalit at Apple.
There is a commercial implementation of it for Windows 95/NT platforms
available from
Functional
Objects Inc., with a personal
version available via free download.
Free versions of Dylan for various UNIX machines
are available from the
Gywdion
group. Other useful Dylan sites include:
- the Introduction of Shalit's book, `The Dylan Reference Manual', gives an overview
and rationale for Dylan;
- Eric Kidd's 'Getting
Started With Dylan' tutorial is the best online tutorial;
- an A First Look at Dylan: Classes, Functions, and Modules an introductory article about Dylan from Apple (Steve Strassman);
- Gwydion's 12 short example Dylan
programs.
- Paul Haahr's Procedural Programming in Dylan compares Pascal and Dylan versions of
several simple functions. Section 3 introduces Dylan's
support for higher-order functions in a gentle way.
(His site also has a YACC grammar for Dylan, and an alternative multiple-inheritance linearization;
- A small Dylan
FAQ (Frequently Asked Questions).
- The open directory project has lots of
dylan
links.
- The Dylan Language
Standard group is managing changes to the Dylan language.
- The draft Dylan
Reference Manual is available in PDF format (2Mb).
A final version of this was published by Apple (via Addison-Wesley)
in 1996, and is available at a special price from Functional Objects.
There is also a nice browsable html version of it.
- the Gywdion
implementation of Dylan, started by the
CMU Gwydion Group and being continued by volunteers (here is their
mailing list archives).
It is available for various
machines
- The Open Directory Project's Dylan
page.
- the Dylan Code
Repository for reusable Dylan code.
- Chris Double has written several example
programs including one that displays .bmp files in a window.
- Peter Norvig's slide presentation on
Design
Patterns in Dynamic Languages includes examples of patterns in
Dylan, LISP, C++, Smalltalk and Sather.
- A Dr. Dobbs Journal article on Dylan (by Tamme D. Bowen and Kelly M. Hall) which defines the semantics of the main Dylan features in Haskell!
- This 1995 MacTech Magazine article (Vol 11, No. 8).
includes a brief description and some screenshots of the
original Apple Dylan Development Environment.
- Miscellaneous old Dylan documents at the CMU AI repository.
Python is another favourite. Interpreted, and
ideal for knocking up quick prototypes, but with a nice module system, lots
of handy libraries, and
almost purely object-oriented.
Apart from Simula-67,
Smalltalk
started the OO craze.
Implementations
are becoming more easily available now.
(See also ObjectShare's
non-commercial VisualWorks
Smalltalk, available for Linux and Windows)
Squeak is an open source Smalltalk
that is becoming very popular.
A lot of Smalltalk-related information and projects are accessible
from the
Panasoft Smalltalk
Links.
Here is a nice
Smalltalk tutorial from IBM.
Some other clean OOLs are:
- Scala is a modern
multi-paradigm programming language
designed to express common programming patterns in a concise,
elegant, and type-safe way. It smoothly integrates features of
object-oriented and functional languages. All Java classes can
be imported and used within Scala programs.
- Blue, a clean OOL
especially designed for teaching first-year students.
- Eiffel
was the first object-oriented language to give good support for
software engineering concepts like design by contract.
- Modula-3
- Oberon,
from Nicolas Wirth, the designer of Pascal.
- Sather
- Component
Pascal is an object oriented programming language most closely
related to Oberon-2. Compared to Oberon-2 it adds a number of
annotations which are intended to enhance the type-safety of
component oriented programs. QUT offers an open source compiler
which generates Java bytecodes or Microsoft.NET output.
Alternatively, Oberon
Microsystems have made their 'BlackBox Component Builder'
compiler/environment for Component Pascal open source now.
- TOM is a new object-oriented
programming language that advocates
unplanned reuse of code (classes can be extended in very flexible
ways, even without source code for them).
- Suneido is a free, open-source,
pure-OO language whose syntax is similar to C++ or Java, but simpler.
It is a safe, dynamic language like Smalltalk, enabling rapid
development. It supports automatic garbage collection,
exception handling and has builtin client-server
relational database, user interface and reporting frameworks.
Available for all Windows platforms, but a Linux version is planned.
- D from Digital Mars
is intended to be a clean successor to C++. It has good support
for design-by-contract programming, like Eiffel.
- How about a simple
OO Forth? It takes less than one screenful of Forth
to define objects, classes and single inheritance.
Then we have the less clean C extensions:
Objective-C
seems less widely used now, but is supported by gcc.
C++
is the most widely used object-oriented language. See:
Readings,
FAQS,
ANSI Standard
or here
A recommended book on the design of C++ is
"The Design and Evolution of C++",
by Bjarne Stroustrup, Addison-Wesley, 1995.
I quite like the
standard
template library (STL) of C++
(
local docs here).
It allows higher-order programming to a certain extent and
comes with about 10 generic data structures and 70 simple
algorithms over them. See Mumit's
STL
Newbie guide for some handy STL hints.
Other STL-like libraries include: the Graph Template Library (GTL).
There seem to be two major contenders for the "best GUI toolkit"
title at the moment.
GTK+
(the GIMP toolkit) is more C oriented, but does slots and signals without a
preprocessor, whereas
Qt uses a
preprocessor (MOC) but has the dis/advantage of being a complete solution
for porting to Windows 95/NT.
The GTK+ toolkit has bindings for several languages, including a
C++ wrapper for GTK+ called
gtk--
(or
FTP).
D is another
object-oriented extension of C, designed for systems programming, but with
garbage collection, runtime type identification and templates.
Of course, there is also
Java
which was designed to be safer and cleaner than C++
(see the
Java white paper,
a
Java
tutorial,
Java Games and
Java Puzzles).
[TODO: update this section, now that I've used Java for a few years.]
The two most attractive aspects of Java are that it can be a
safe language (all errors are caught by the compiler or bytecode
checker or cause runtime exceptions), and its portability (especially its
wide range of standard libraries).
Some problems with Java that I've heard about include:
hard to format a floating point number, integers etc. are not objects
so cannot be subtyped or subranged, non-portable thread semantics,
text I/O difficult for beginners. The lack of generics was a real
pain in Java (lots of type casting), but now Java 5.0 has
fixed this at last.
Here are several interesting extensions/variants of Java:
- The Java
Modelling Language, is Java extended with specification
facilities (class invariants, preconditions, postconditions etc.);
These can be added within comments, so that existing Java tools
are unaffected, but the JML tools can perform deeper analysis of
the program to detect more errors.
- Jbed is a commercial
real-time subset of Java that supports deadline-driven scheduling.
- There are also quite a few other
languages being implemented on top of the Java Virtual Machine, see
here,
here
and here.
Objects have also been added onto
Perl
(Perl 4 was my least-liked language!) and
Ada.
In fact, Ada was actually the first ISO standardized OO language (Ada95)!
A new ISO version of Ada, currently known as Ada200Y, will include
Java-like interfaces and a larger predefined library etc.
Rational Software Corporation have done an interesting
comparison
between development in C and Ada.
Rational Software Corporation also
sell Purify (a heap-memory checker) and are responsible for the OO
Unified Modelling
Language, which is now the industry standard for specifying
the structure of OO systems.
Finally, CLU is an old but influential language that introduced
important ideas for
iterating through collection objects,
for
exception handling and a carefully-designed theory of
object invariants, pre/post conditions etc.
Here are some Software Engineering methods/tools for
object-oriented programming:
See
John
Yeager's S/W Engineering resources for more information.
Functional Programming Languages
Haskell is the most popular
functional programming language and is the one that I've used
a lot (for example, my Z animator,
Jaza).
It is an elegant lazy high-level language, with fast compiled implementations
plus a interpreter (HUGS) that is good for development. It also
comes with a large collection of amazing libraries for writing
parsers, pretty-printers, MIDI composition programmes (Haskore) etc.,
plus the ability to interface to arbitrary C procedures in
a functionally clean way.
One of the advantages of Haskell is that expert programmers can
extend the language by defining their own operators and 'monads',
to get a very concise application-specific language. The
disadvantage of this power is that if you overuse it, it becomes
difficult for other people to read your programs!
Other popular functional programming languages include
the eager (non-lazy) ML family of languages, such as
Standard ML and
Objective CAML.
Here is an introductory book
Objective CAML for Scientists.
Logic Programming Languages
There is a WWW
virtual
library for logic programming. Michael Ley has a database/logic
programming
bibliography
The ALP (Association of Logic Programming)
newsletter.
I am part of the
Starlog
research group, which is designing and implementing a new pure
logic-programming language that is especially suited to reactive and
real-time programming. Recently, I've implemented a version of Starlog
for controlling
Lego Robots!
Prolog is the most commonly known logic programming language, albeit impure.
A few well-known implementations are:
Quintus Prolog,
SICStus Prolog,
Eclipse Prolog,
SWI Prolog (free!).
Qu-Prolog
is Prolog customised for formal methods (it handles quantifiers,
object-variables and substitutions as primitives).
The Prolog at
VIP is free for non-commercial use.
Another free one is
TRINC-Prolog.
Michael D. Kersey recommends
Amzi! Logic Explorer and
the "Adventures in Prolog" (with a "very nice and complete
tutorial").
See
here for other free Prologs. [mindgap@my-dejanews.com,
Alexander.Apostolovski@worldonline.be, and
mkersey@metricom.com; comp.lang.prolog, 12Mar99.]
Roman Bartak's
Interactive Prolog
Guide includes FAQs, program samples, implementations, and references.
The
BURKS
project provides documentation and free
Prolog
implementations for DOS, Windows etc.
LPA Prolog for Windows -- with an IDE
and single-step debugger -- offers a free 30-day trial. [Nov98]
Amzi! Logic Explorer is free for
personal use. It comes with a full tutorial
and sample programs, plus a GUI development environment.
Amzi! inc. also offers a Prolog compiler and embeddable
libraries (for C/C++, Java, Delphi, VB, etc) for a 90-day trial. [Dec98]
Mercury is an
elegant, pure, logic programming language from Melbourne University. The
fastest logic programming language around...
The
Cetus
Links OO Prolog page has links to object-oriented
logic programming languages.
Curry
is an extension of Haskell that adds logic-programming features like
logical variables, constraint solving and concurrent and distributed
programming.
Here are some useful online sites for constraint logic programming:
The quarterly
Logic
Programming Newsletter is now online.
The textbook
Logic, Programming
and Prolog (2ed) by Ulf Nilsson and Jan Maluszynski is now
available online. It covers theoretical aspects of logic programming as
well as practical programming in Prolog, and extensions logic programming
such as equational logic programming, constraint logic programming and
query answering in deductive databases.
Transformation Languages
Some languages for transforming models and programs:
- QVT (Query/View/Transformation) is an OMG standard for
transforming models into other models.
Text Formatting Languages
LaTeX is the defacto
text formatting system for academic papers containing mathematics.
There is lots of online
reference
material for it. See also the
Comprehensive TeX Archive Network
(
CTAN).
More documentation is
here.
Basser Lout
is another text formatting language that produces Postscript/PDF directly
and has a more elegant (and functional!) programming/macro language than TeX.
For HTML (the web markup language):
XML-related Languages
- The World Wide Web Consortium (W3C)
is the official source for XML-related documents, and has lots
of tools links.
- ZVON.org has lots of XML-related
tutorials and reference manuals, including an XML glossary, unicode
character references a good reference for XSLT
Documentation Generators
There are lots of programs available for generating
HTML and/or LaTeX documentation from C++ source files etc.
For example:
- Javadoc
generates HTML pages from Java source code.
- Doxygen generates
crosslinked HTML pages in a style similar to the Qt documentation.
It also handles the Signal/Slot declarations of Qt.
Free Implementations
A
Catalog of Free Compilers
and Interpreters.
Poplog
is an open source, extendable, portable,
multilanguage software development environment providing
incremental compilers for several interactive programming
languages: Pop-11, Prolog, Common Lisp, and Standard ML.
It comes with documentation, libraries, and teaching materials
for AI and Computer science (and more general programming).
Language Design Issues and Mistakes
Here are a few interesting papers about language design: