Special Topics in Software Engineering:

Functional Programming for Databases

339.304 2KV Stanczyk Block Begin: 3.6.2009

Dr. Stefan Stanczyk, Oxford Brookes University
stef@brookes.ac.uk

Objectives

The objective of this course is to present the functional programming (FP) approach to the development of database applications. The attributes of FP (such as declarativeness, high level of abstraction, elegance of data types, genericity, polymorphism, computability of programs, to mention but a few) instigate deeper insight into the database architecture. The devised database objects would not be confined to the pre-conceived (and usually very regular) structures of say relational model, and thus the associations between the objects can be expressed accurately, rigorously and truthfully. Should it be required, the outcome of such an abstract design may then be transformed into relational or object-oriented schemes.

The programming language used for this presentation is Haskell, the de facto standard language for lazy evaluation FP. The simplicity of the Hugs interpreter makes it a very good environment for learning the language; Hugs is also freely available for the majority of platforms (Unix, MacOS, Windows, and DOS).

Contents

Database foundations revisited - concepts, structures, operations, behaviour. Relational, binary and extended functional data models for databases. Model of computation based on Church's λ calculus.

Imperative versus declarative programming. Functional programming paradigm. Programming elements and components in a typed FP language: functions, primitive and defined types, overloading, guards, currying, recursion, list comprehension pattern matching, lambda expressions, higher order functions, type classes, algebraic types, infinite lists, sets, relations. Data structures and abstract data types. Examples of classical algorithms (e.g. sorting, merging) expressed in a functional style.

Examples of common database processes coded in Haskell. Functional database programming systems (e.g. Daplex). Relational DB structures and operations expressed in a functional style.

Prerequisite Knowledge

Familiarity with database concepts and reasonable programming skills are expected; certain mathematical ability will be beneficial. No prior knowledge of functional programming or its theoretical basis is assumed.

Lecture Times

Date Time Room
We, 03.06.2009 15:30-18:00 T 041
Th, 04.06.2009 15:30-18:00 UC 5
Fr, 05.06.2009 13:45-16:15 BA 9909
Mo, 08.06.2009 15:30-18:00 T 212

Downloads

begin.pdf
cLambda.pdf
Hugs1BasicList.pdf
Hugs2FunClass.pdf
XamplesDBmodels.pdf

Exam

The marks for this course will be obtained by a project which the students have to submit until July 30, 2009.

References

  • S. Thompson, Haskell - The Craft of Functional Programming, 2nd ed., Addison-Wesley, 1999
  • www.cs.ukc.ac.uk [the above book's companion web site]
  • www.haskell.org [Haskell web site]
  • F. Rabhi, G Lapalme, Algorithms: a functional programming approach, 2nd ed., Addison-Wesley, 1999
  • J. R. Abrial, Data Semantics, Proc. of IFIP Working Conf. on DB Management, North Holland, 1974
  • D. Shipman, The Functional Data Model and the Data Language DAPLEX, ACM TODS, Vol.6, No 1, March 1981, pp. 140-173
  • S. Stanczyk, et al, Theory & Practice of Relational Databases, Taylor & Francis, 2001