## Subject Outline

There is a Departmental Web Page on CSC431.

## Lecture Outline

L1
What is persistence? Some Principles. Orthogonal persistence. Persistence by Reachability. An introduction to Napier88. Referential Integrity. The Binding Spectrum.
L2
Persistence Language Examples: Napier88, Eiffel. Napier88 mechanics. Type Security, Run time type checking.
L3
Type systems for persistence, polymorphism, the Napier88 environment mechanism, the $\chi$ capability mechanism.The commit and abort functions.
L4
First class procedures, generators, reflection, hyperprogramming.
L5
Implementation issues, persistent and transient spaces, pointer swizzling, page based persistent stores, before look versus after look.
L6
Other languages, other environments. Galileo.

1. C.Strachey; Fundamental Concepts in Programming Languages; Oxford University Press, Oxford, 1967
2. M.P.Atkinson, P.J.Bailey, K.J.Chisholm, P.W.Cockshott and R.Morrison; An Approach to Persistent Programming, The Comp. J., 26,4,360-365. 1983.
3. R.Morrison, A.L.Brown, R.C.H.Connor and A.Dearle; The Napier88 Reference Manual, Universities of Glasgow and St. Andrews, PPRR-77-89.
4. M.P.Atkinson and R.Morrison; Procedures as Persistent Data Objects, ACM Trans. Prog. Lang. and Sys., 7,4,539-559, Oct. 1985.

## Exercises

1. Not for assessment Setup Napier environment, compile and execute euclid.N.
2. Due 13 May Write a Napier88 program to meet the following specifications:
1. The program is to determine the results of a round of Australian Football League matches.
2. For each match of the round (there are 8), the program prints a line of text identifying the winning margin, positive if the home team wins, negative if the away team wins, followed by the name of the winning team.
3. Input to the program consists of a single line identifying the round number (an integer), followed by 8 lines of information, each line containing:
1. Home team name
2. Home team goals
3. Home team behinds
4. Away team name
5. Away team goals
6. Away team behinds
3. Not for assessment Explore the napier88 programming environment.
4. Due 27 May Use the napier88 programming environment to create a persistent data structure that maintains football team statistics.
1. There should be up to 22 rounds of information, where each round consists of 8 matches, and each match gives statistics for 2 teams. Let the round number be k, and the team number be n. Team number n has team name name(n). This relation holds over all matches, all rounds.
2. Each team's statistics include the number of points kicked for the team, called pf(k)(n), and the number of points kicked against the team, called pa(k)(n).
3. Assume that an input line from exercise 2 has the following form for round k
hn hg hb an ag ab
and that hn = name(n). Then
pf(k)(n) = pf(k-1)(n) + 6*hg + hb
and
pa(k)(n) = pa(k-1)(n) + 6*ag + ab
for all n. A similar relation holds in the case that an = name(n).
4. If k < 1, then pf,pa(k-1)(n) = 0 for all n.
5. updateRound(k : int) is a procedure whose postcondition satisfies the relations in point 3 for all n.
Hint: Rather than write a complete program, recall that the programming environment allows execution of selections in the edit window.
5. Not for assessment Program Reuse: Suppose you had to rewrite all your code so that it handled the VFL (Victorian Football League), with only 10 teams. What would you have to change in your code? Or suppose you had to write your code to handle the NBL (National Basketball League) with 11 teams (one team gets a bye each round), a different number of rounds, and different scoring rules. Or think of your own favourite sport, and its scoring rules, fixture structures and statistical outcomes. What changes then? Anyone for cricket?

Challenge: Think about how you could write a generic competition generator program, that when supplied with the appropriate parameters, generated all the code necessary to handle exercises 2 and 4.