Note: This page refers to a past version of the course. You can also consult the current APL course web pages.
Course webpage. Jump to lecture: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10.
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:
ocaml
implementation. For example, typing ocaml
at the command line on
a DICE machine. Implementations of OCaml are available for Linux, Windows,
and Mac OS X.Also, Wikipedia's History of programming languages is an easy and informative read.
References:
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.
Different examples of types in programming languages; what is a type system; a problem with Java array subtyping; semester lecture plan.
Homework:
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:
References:
Robin Milner. A theory of type polymorphism in programming, Journal of Computer and System Sciences 17(3):348–375. December 1978.
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:
max
, as featured in the slides, that will
select the account with greatest balance.OCaml graphics are described in the language manual and Chapter 5 of Developing Applications with Objective Caml.
References:
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.)java.util.Collections.max
in the Java Platform, Standard Edition 6 API Specification. Sun, 2006.Rémy is the chief designer of the OCaml object system. This tutorial covers all of OCaml; Objects are treated in Chapter 3.
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.
Demonstration of quadtrees and octrees for collision detection; presentation of coursework topics; suggested report outline; notes on working practices.
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™.
References:
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.
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:
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:
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.
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:
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.
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.
Leavens and Cheon. Design by Contract with
JML. Draft paper, available online from http://jmlspecs.org
. September
2006.
Lilian Burdy, Yoonsik Cheon, David R. Cok, Michael D. Ernst, Joseph R. Kiniry, Gary T. Leavens, K. Rustan M. Leino and Erik Poll. An overview of JML tools and applications. International Journal on Software Tools for Technology Transfer, 7(3):212–232, June 2005. DOI: 10.1007/s10009-004-0167-4.
Challenge: Install and use ESC/Java 2.
Suggested framework:
eclipse-3.3
).eclipse-3.3 -vm
/usr/lib/jvm/java-1.5.0/bin/java
).http://kind.ucd.ie/products/opensource/ESCJava2/escjava-eclipse/updates
,
installed from within Eclipse.http://i12www.ira.uka.de/~key/download/addons/
. Use the
ESC/Java 2 plugin preferences to point it at this external Simplify.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.
References:
http://kind.ucd.ie/products/opensource/ESCJava2
Current lead maintainers of ESC/Java 2. Site has the software, documentation, release notes, and some historical material.
http://jmleclipse.projects.cis.ksu.edu/docs/esc-java.shtml
The ESC/Java 2 plugin is actually distributed from Dublin, but the documentation is still in Kansas.
http://jmleclipse.projects.cis.ksu.edu
SAnToS labs have several projects on specification and verification of Java code. This one is a front-end to the standard JML tools.
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.
Links:
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.
Links:
The Sloan Digital Sky Survey (SDSS) and its SkyServer database.
SQL injection is real.
Database connectivity frameworks.
ODBC — Open Database Connectivity
JDBC — Java Database Connectivity
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:
Don Box, Anders Hejlsberg. LINQ: .NET Language-Integrated Query. Microsoft Developer Network, February 2007.
Thursday's lecture will be about language integration in F#.
Read about F# at the F# home page and What is F#?
See how close it is to OCaml with Flying Frog's Introduction to F#.
References:
Lots of LINQ information, articles, and recent news.
Overview article, with several examples of LINQ in use as well as details on the language extensions that support it.
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.
Detailed examination of LINQ implementation of SQL integration.
The Cω programming language extends C# with novel concurrency and datatype constructions, including those suited for accessing relational and XML data.
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.
Limsoon Wong. Kleisli, a Functional Query System. Journal of
Functional Programming, 10(1):19–56, January 2000.
Author
preprint as PDF
DOI: 10.1017/S0956796899003585
Limsoon Wong. The Functional Guts of the Kleisli Query System. In
ICFP 2000: Proceedings of the Fifth International Conference on
Functional Programming. ACM SIGPLAN Notices, 35(9):1–10, 2000.
DOI: 10.1145/357766.351241
Informatics Forum, 10 Crichton Street, Edinburgh, EH8 9AB, Scotland, UK
Tel: +44 131 651 5661, Fax: +44 131 651 1426, E-mail: school-office@inf.ed.ac.uk Please contact our webadmin with any comments or corrections. Logging and Cookies Unless explicitly stated otherwise, all material is copyright © The University of Edinburgh |