Lecture 17: XML processing with CDuce

26 November 2010

Potted history of languages for XML processing. CDuce as a general purpose language with powerful type structure oriented towards XML processing. XML schema validation as type-checking. Types constructed using regular expression types, recursive types, set-theoretic boolean operators and lisp-like encodings for values. Patterns reinvented as types with capture variables rather than a separate concept. Advanced patterns, map operators and support for SQL-like querying.

Homework

  • Try out the examples shown in the slides (fill in the details).
  • Work through the tutorial at http://www.cduce.org.

Lecture 16: Bidirectional programming, continued

23 November 2010

A revisited example in Boomerang which projects a view that removes the last field of an address-email-office list. Two issues with the basic lens constructs: (1) the records must be updated in the same order that they appear, and (2) there is no flexibility in layout, for example, the amount of whitespace. The first case is addressed with resourceful lenses and the second with quotient lenses. Ideas behind the semantics of each construct. For resourceful lenses, the idea of a skeleton and its resource content. For quotient lenses, the idea of equivalence relations and canonizers. Finally, in each case, the practical programming features which exploit them. Briefly, a third way for bidirectional programming was mentioned: probing the behaviour of the get function to automatically define a put function.

Homework

  • Try some more sophisticated examples in Boomerang.

Lecture 15: Bidirectional Programming

19 November 2010

Motivations and concepts behind bidirectional programming. Motivations include the classic database view-update problem, as well as software engineering (“round-tripping” in model-driven development), user interface construction (implementing the Model-View-Controller pattern), data synchronization and marshalling. The basic requirements for get and put functions satisfying a loose specification. Introducing Boomerang and its semantic foundations based on lenses which encapsulate get, put and create functions. A first Boomerang example.

Homework

  • Show that the GetPut, PutGet and CreateGet laws are satisfied by the simple lenses defined on the slides.
  • Download Boomerang from the Harmony Project and try it out.

At the link above, you’ll also find pointers to research papers and slides about Boomerang. (The slides are definitely worth looking at as they have a more detailed exposition of possible behaviours for put and get functions than we went into in the lecture — they are also more pretty to look at than mine!)


Guest Lecture tomorrow: Andrew Birkett

15 November 2010

Tomorrow’s lecture (usual time, usual place) will be given by Andrew Birkett, Senior Engineer at Amazon. He says:

I’ll be sharing my personal views about the significance of studying programming languages and the positive benefit it can have on your career. I’ll be looking at the forces which guide programming language design, and diving into details of the Erlang language as a concrete example. Having worked in industry for a while, I hope to provide some interesting context to this topic ….

Andrew’s web page is at the brilliantly named domain nobugs.org.


Lecture 14: Practical tools for Java Correctness

12 November 2010

Practical tools for Java Correctness. We looked at JML, a language for writing assertions in a model-oriented specification style. JML comes with the tools jmlc and jmlunit. We looked at the tool ESC/Java2, which can also use JML annotations. We discussed the common lack of completeness and soundness for tools like this: leading to missed defects and false positives. We mentioned some further and specialised annotations extending core JML (non_null, unreachable, modifies, pure) and specification inheritance. Finally, the FindBugs tool was briefly introduced; it needs no specification at all, but can make use of Java annotations such as @NonNull.

Tips for installing tools

Please add comments to let us know how you get on!