Lecture 9: Using SQL from Java

26 October 2010

This is the first of three lectures on integrating domain-specific languages with general-purpose programming languages. In particular, SQL for database queries.
Read the rest of this entry »


Lecture 4: Coursework Assignment Topics

1 October 2010

Presentation of the five coursework topics. Some good and bad examples of referencing. Requirements of preliminary report; investigation; and final report. Notes on working practices: aims of homework, exercises, coursework; avoiding plagiarism.

You need to commit to a topic choice by next Friday. This involves finding and reading references, as well as downloading, installing and running your chosen system. If you have difficulties with this, post a question below.

Links: Slides; Sheet; Coursework assignment; University marking scheme; Essay grade descriptors.


Lecture 18: Bridging Query and Programming Languages

11 March 2010

How the LINQ framework for Language-Integrated Query aims to reduce the impedance mismatch between programming languages and query languages.

General background on Microsoft’s .NET Framework: it’s a large platform for program development; as part of this, it has some interesting programming language features. In particular its support for working in multiple languages, exchanging strongly-typed data and code at a high level.

Review of standard SQL-query-as-a-string technique in Java and (almost identically) in C#. Advantages, limitations. What LINQ does to lift some of the limitations. There is convenient SQL-style syntax; but that’s a distraction, the key advance is to connect the semantics of the two language domains. This then brings in type checking, smart IDEs, compiler optimisations, automatic query bundling, abstraction of query constructors, query constructor constructors, user-extensible query libraries, etc. etc.

How this requires (and contributes) a sackful of additional language features, most taken from existing research languages, which themselves have wider application; LINQ as a Trojan horse.

The end result is that a LINQ programmer can write a simple boolean test in C#, or any .NET language, and use it to filter all kinds of data: an array in C#, a table in SQL, or a tree in XML. All being well, LINQ will inspect the semantics of the underlying expression and convert it to the right domain.

Next week: what else it can do, when it doesn’t work, and how that might be fixed.

Link: Slides

What’s in a Name?

During the lecture I referred to the work of Mike Just and others on knowledge-based authentication. There is a discussion of this on the Light Blue Touchpaper security blog, and you can also read the recent published paper and some slides from a recent presentation.

Update: Also appears on BBC News, Telegraph, etc.


Lecture 7: Haskell, Types and Classes

1 February 2010

This block of four lectures are arranged around some features of the Haskell type system. They aren’t just specific to Haskell, though: several appear in other languages too, and they all address general programming issues. Haskell does make a convenient setting to examine them, as the language development has a strong connection to programming language research, and it is sufficiently popular that there is a wide array of commentary out in the blogosphere on how well that works out.

The lecture covered background on type systems in programming languages, what they are used for and how they might be tricky. The interaction of types, subtypes and inheritance in object-oriented languages is an example of this, which Java’s covariant subtyping of arrays conveniently demonstrates. Haskell’s type classes tackle many of the same issues, but from a substantially different direction. Arising originally from attempts to rationalise overloading of basic operations like equality, type classes have grown far beyond this to serve as a tool for imaginatively building a range of high-level programming abstractions.

The presentation itself was somewhat distorted by the non-operation of the projector screen. My apologies, I’ll report it and see if things go better on Thursday.

Link: Slides

Reading

For Thursday’s lecture, read the following paper and set of slides.

For further reading, see the lecture slides. These carry a range of embedded hyperlinks to references, research papers, and background material on the various examples.

Exercise

In the spirit of the diagram from Cook’s paper, can anyone identify a pair of classes A and B, in any OO language or library, where A is (or should be) a subtype of B, while B inherits (or ought to, for code reuse) from A?