cs205: engineering software?
(none)
05 April 2010

CS205 Notes 40 (1 December 2006)

Schedule Update

Final Exam

The Final Exam will be handed out on Monday, 4 December and due on Monday, 11 December. The exam will be take home, open book and notes, and similar in format to Exam 1.

The exam will cover all material in the class up to and including Wednesday's lecture (Class 39), assigned reading, problem sets 1-5, and your projects. It will emphasize material covered since the midterm exam, but may include questions on any course material. You should not be surprised if it has questions about subtyping, concurrency, design, type safety, Java byte codes and verification, and GUI programming. You should also not be surprised to find questions that cover material from the first half of the class also: writing good specifications, reasoning about data abstractions and design.

The exam will also include teammate assessment questions for the project (this replaces the previously mentioned "Teammate Assessment Form").

Project Presentations

In Monday's class, each team will have an opportunity to give a presentation (including a demo) of your project. Like all good presentations, your presentation should tell a story not convey a list. The challenge is to make sure you have an organized and connected story, rather than just listing what you have done. A good presentation will provide a clear motivation for the software you have built, explain what problem it solves, and show how someone would use it to solve that problem. Your presentation should be prepared. There should be a plan for how you will use your time effectively to get the main points across well.

Project Reports

Project final reports are due Tuesday, before 5pm. They should be turned in to Brenda Perkins in the CS office (I will be out of town Tuesday). All teams must submit by email a zip file containing all of your project code and other files before 5:00pm Tuesday.

If your team does an outstanding presentation and demo on Monday, you will not need to submit a formal project report. An outstanding presentation must include a good story of why your project is useful and a demonstration showing the software you built functioning well. You will be notified shortly after class Monday if this is the case.

Otherwise, you need to turn in a paper project report containing:

Program Verification

Floyd-Hoare Triple
P { code } Q
Partial correctness: If P is true before executing code, then Q is true after.

Total correctness: Partial correctness and code is guaranteed to terminate.

Axiomatic Semantics Rules

Assignment

P[x / E] { x := E } P

Replace all free oocurances of x with E.
What does this rule assume about E and assignments?






Sequencing

P { S } Q, Q { T } R
Þ {P } S; T { R }

Conditional Rule

B and P { S } Q, !B and P { T } Q
Þ P { if (B) S else T } Q

While Rule

{ Inv and B } S { Inv }
Þ { Inv } while (B) S { !B Ù Inv }

Inv is the "loop invariant". Similar to a rep invariant, a loop invariant is a predicate that is true before entering the loop, and if it is true at the beginning of a loop iteration it is also true at the end of the loop iteration.

What more would we need to show total correctness?





Code from PS2:
public static int [] histogram (int [] a)
{
   int maxval = 0;
   for (int i = 0; i < a.length; i++) {
      if (a[i] > maxval) {
         maxval = a[i];
      }
   }
   int histo [] = new int [maxval + 1];
   for (int i = 0; i < a.length; i++) {
      histo[a[i]]++;
   }
   return histo;
}
Simplified first loop:
   while (i < a.length) {
      if (a[i] > maxval) {
         maxval = a[i];
      }
      i++;
   }