Advances in Programming Languages


Note: This page refers to a past version of the course. You can also consult the current APL course web pages.

Lecture Log

Course webpage. Jump to lecture: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10.

2008-01-10 Lecture 1: What's so important about language?

Introduction to the course; review of some programming languages; how languages shape programs; some topics to be covered in the course.

Homework: Lecture 2 concerns the language Objective Caml (OCaml). You can find out about this at the Caml Language home page. Before the next lecture you should:

Also, Wikipedia's History of programming languages is an easy and informative read.


George Boole. An Investigation of the Laws of Thought on Which are Founded the Mathematical Theories of Logic and Probabilities. Macmillan, 1854.

Ludwig Wittgenstein. Tractatus Logic-Philosophicus, Ogden (trans.), Routledge & Kegan Paul, 1922. English translation of German original, Logisch-Philosophische Abhandlung, Wilhelm Ostwald (ed.), Annalen der Naturphilosophie 14, 1921.

George Orwell. Nineteen Eighty-Four. A Novel. Secker & Warburg, 1949.

Alan Perlis. Epigrams on Programming. ACM SIGPLAN Notices 17(9):7–13. September 1982.

Jeremy Gibbons. An unbounded spigot algorithm for the digits of π. American Mathematical Monthly 113(4):318-328, 2006.

Graham Hutton and Erik Meijer. Monadic parsing in Haskell. Journal of Functional Programming 8(4):437-444, July 1998.

Chris Okasaki. Even Higher-Order Functions for Parsing or Why Would Anyone Ever Want To Use a Sixth-Order Function? Journal of Functional Programming, 8(2):195-199, March 1998.

Donald Knuth. Structured Programming with go to Statements, ACM Computing Surveys 6(4):261–301, December 1974.

2008-01-14 Lecture 2: Some types and a little OCaml

Different examples of types in programming languages; what is a type system; a problem with Java array subtyping; semester lecture plan.


By the next lecture on Thursday:

Lecture 3 really will be concerned with the OCaml language. If you have not done the homework from last week, do it now. If you are still uncertain about OCaml programming, try these online guides:


Robin Milner. A theory of type polymorphism in programming, Journal of Computer and System Sciences 17(3):348–375. December 1978.

2008-01-17 Lecture 3: Row variables in OCaml

Brief overview of basic expressions and types in OCaml; example of region quadtrees coded in OCaml; the challenge of static type-checking for object-oriented programming; OCaml's use of row variables and row polymorphism to provide structural typing for objects.

Homework: Basic exercises, just reviewing the lecture material:

More advanced exercises, requiring you to write novel code:

OCaml graphics are described in the language manual and Chapter 5 of Developing Applications with Objective Caml.


Method java.util.Collections.max in the Java 2 Platform, Standard Edition, v1.3.1 API Specification. Sun, 2001. (This method was present in v1.2.2, but Sun no longer provide online documentation.)

Method java.util.Collections.max in the Java Platform, Standard Edition 6 API Specification. Sun, 2006.

Didier Rémy. Using, Understanding, and Unraveling The OCaml Language: From Practice to Theory and vice versa. In Applied Semantics, Proceedings of the International Summer School APPSEM 2000. Lecture Notes in Computer Science 2395. Springer, 2002.

Rémy is the chief designer of the OCaml object system. This tutorial covers all of OCaml; Objects are treated in Chapter 3.

Didier Rémy and Jérôme Vouillon. Objective ML: An effective object-oriented extension to ML. In Theory And Practice of Object Systems 4(1):27–50, 1998.

An original paper setting out the use of row variables for ML. Quite technical, and the syntax is different to that eventually used in OCaml.

2008-01-21 Lecture 4: Coursework assignment

Demonstration of quadtrees and octrees for collision detection; presentation of coursework topics; suggested report outline; notes on working practices.

2008-01-24 Lecture 5: Hoare logic

First-order logic; a simple imperative language; Hoare triples. Rules for derivation; validity with respect to an operational semantics; soundness and completeness. Applications in program specification and verification; tools for formal verification; Design by Contract™.


C. A. R. Hoare. An axiomatic basis for computer programming. Communications of the ACM 12(10):576–580, 1969. DOI 10.1145/363235.363259

Hoare's original article setting out the use of triples. Note that this uses the notation P{C}Q with braces around the command rather than the assertions.

Hoare and Jones (editor), Essays in Computing Science. ACM Classic Books Series. Originally published by Prentice Hall, 1989.

A collection of articles by Hoare. Proving programs correct is addressed in most chapters, but particularly 4 and 5.

Both the article and the book should be directly available from machines within the University. For access from outside you can use a proxy provided by the University Library:

Eiffel Software. Building bug-free O-O software: An introduction to Design by Contract™. Available from

Design methodologies often attract heated discussion of their effectiveness. For example, would design by contract have averted the Ariane disaster? Look at the following two articles:

Glynn Winskel. The Formal Semantics of Programming Languages: An Introduction. MIT Press, 1993.

Textbook introduction to the subject. Chapter 6 presents axiomatic semantics and Hoare logic. Good if you want to find out about more about language semantics and verification.

Tobias Nipkow. Hoare Logics for Recursive Procedures and Unbounded Nondeterminism. In Computer Science Logic: Proceedings of CSL 2002. Lecture Notes in Computer Science 2471, pages 103–119. Springer, 2002. DOI: 10.1007/3-540-45793-3_8

Technical article describing a machine-checked proof that Hoare logic is sound and complete. Section 3 gives some history of the "consequence" rule. Again, the article is available directly from within the University, or through a library proxy from outside:

Keats, Ode to a Grecian Urn. In The Oxford Book of English Verse, 1250–1900, 625. Quiller-Couch (ed.) Oxford: Clarendon Press, 1919. Available online at
Beauty is truth, truth beauty — that is all
Ye know on earth, and all ye need to know

Keats praising the virtue of "Mysteries, doubts without any irritable reaching after fact & reason". Not a fan of formal semantics, we guess.

2008-01-28 Lecture 6: JML — The Java Modeling Language

Review of Hoare logic. Model-based specification as a technique for system design. Design features of JML. Some examples: preconditions, postconditions, invariants; model variables, methods and classes; ghost variables, assertions, assumptions. JML as a common language across multiple tools for software specification and verification.

Homework: Read these two short articles on JML.

Both are available through the Java Modeling Language home page.

Challenge: Install and use ESC/Java 2.

Suggested framework:

2008-01-31 Lecture 7: ESC/Java 2 — The Extended Static Checker for Java version 2

Review of JML. Overview of ESC/Java 2: approach, capabilities, the range of static checks available, its use of JML. Limitations on its soundness and completeness, and their effect in practice. Demonstration of ESC/Java 2 running as a plugin to the Eclipse integrated development environment.


ESC/Java 2 home page, KindSoftware, Systems Research Group, University College Dublin.

Current lead maintainers of ESC/Java 2. Site has the software, documentation, release notes, and some historical material.

Eclipse plugin for ESC/Java 2, web site. SAnToS laboratory, Kansas State University.

The ESC/Java 2 plugin is actually distributed from Dublin, but the documentation is still in Kansas.

JMLEclipse plugin. SAnToS laboratory, Kansas State University.

SAnToS labs have several projects on specification and verification of Java code. This one is a front-end to the standard JML tools.

Patrice Chalin, Joe Kiniry, Gary Leavens, and Erik Poll. Beyond Assertions: Advanced Specification and Verification with JML and ESC/Java2. In Formal Methods for Components and Objects: Proceedings of the 4th International Symposium FMCO 2005, Lecture Notes in Computer Science 4111, pages 342–363. Springer, 2005. DOI: 10.1007/11804192_16

K. Rustan M. Leino. Extended Static Checking: A Ten-Year Perspective. In Informatics: 10 Years Back, 10 Years Ahead. Lecture Notes in Computer Science 2000, Springer. DOI: 10.1007/3-540-44577-3_11

Cormac Flanagan, K. Rustan M. Leino, Mark Lillibridge, Greg Nelson, James B. Saxe, Raymie Stata. Extended Static Checking for Java. In Programming Language Design and Implementation: Proceedings of the ACM SIGPLAN Conference PLDI 2002. ACM SIGPLAN Notices 37(5):234–245. DOI:10.1145/512529.512558

Donald H. Rumsfeld. Defense Department briefing, 12 February 2002. Also in Hart Seely, Pieces of Intelligence: The Existential Poetry of Donald H. Rumsfeld. Simon & Schuster, 2003.

2008-02-11 Lecture 8: Spec#

Video of a lecture by Rustan Leino to the 2006 Microsoft Research Faculty Summit, presenting the Spec# language, which extends C# with support for automated program verification. Leino demonstrates the language integration with Visual Studio, and then explains features of Spec# like reasoning about non-null pointers and contract-style preconditions.


2008-02-14 Lecture 9: Domain-Specific Languages — Using SQL from Java

SQL as a high-level declarative programming language. Domain-specific languages. Automated creation and manipulation of SQL. Example: SkyServer. Description of HTML injection and SQL injection. Accessing databases from programming languages: ODBC, JDBC, sample Java code for SQL queries. Demotion of SQL queries from structured programming to flat strings.

Homework: Have a look at these two tutorials on database access in Java and C#.

You don't need to work through every detail, but the key is to see how these languages provide control of SQL.


The Sloan Digital Sky Survey (SDSS) and its SkyServer database.

SQL injection is real.

Database connectivity frameworks.

2008-02-18 Lecture 10: Bridging Query and Programming Languages

LINQ: Language Integrated Query for .NET. Overview of Microsoft's .NET framework. Application management. Support for multiple programming languages. Common intermediate language, types, runtime. Accessing SQL from Java and from C#. Aim of closer query/programming language integration. LINQ example using SQL-style syntax; its expansion into method calls. Programming language features added to C# in support of this: lambda expressions, extension methods, structural datatypes, anonymous datatypes, type inference, expression trees and metaprogramming.

Homework: Read this overview of LINQ:

Thursday's lecture will be about language integration in F#.


The .NET framework. There is a lot of information available on the Microsoft Developers Network; here are a few starting points.


The LINQ project home page.

Lots of LINQ information, articles, and recent news.

Don Box, Anders Hejlsberg. LINQ: .NET Language-Integrated Query. Microsoft Developer Network, February 2007.

Overview article, with several examples of LINQ in use as well as details on the language extensions that support it.

Anders Hejlsberg on LINQ and Functional Programming. Video, January 2007

Interview with the chief architect of C#. This appears on a blog that is currently awash with LINQ reference material: Charlie Calvert's Community Blog.

Dinesh Kulkarni, Luca Bolognese, Matt Warren, Anders Hejlsberg, Kit George. LINQ to SQL: .NET Language-Integrated Query for Relational Data. Microsoft Developer Network, March 2007.

Detailed examination of LINQ implementation of SQL integration.

Research background. The LINQ system did not spring into life fully-formed: it draws on a considerable body of existing programming language research. Nor is it the only system to work with query and programming language integration. These are a couple of specific precursors.

The Cω programming language extends C# with novel concurrency and datatype constructions, including those suited for accessing relational and XML data.

The Kleisli Query System

The Kleisli project built a novel system for broad-scale data integration, using ideas like list and set-comprehension to provide a rich Collection Programming Language (CPL) for describing complex queries over multiple distributed databases.

The main application domain for Kleisli is bioinformatics, and the technology was commercialised in the DiscoveryHub data integration tool.

The following papers describe some of the programming language foundations of Kleisli, with examples taken from bioinformatics applications.

Home : Teaching : Courses : Apl : 2007-2008 

Informatics Forum, 10 Crichton Street, Edinburgh, EH8 9AB, Scotland, UK
Tel: +44 131 651 5661, Fax: +44 131 651 1426, E-mail:
Please contact our webadmin with any comments or corrections. Logging and Cookies
Unless explicitly stated otherwise, all material is copyright © The University of Edinburgh