Lecture #2
July 5th 1995

1. Software life cycle
   a. Analysis/Specification -- what needs to be done? 
		                set budget ...
	  		        set milestones ...
				Choose hardware/software

   b. Design - How to do it? what classes? how they interface?
	        key terms: loosely coupled, highly cohesive.
		Use of nouns and verbs found in specifications in determining
  		objects and operations. Encapsulation, Inheritance,
                and Polymorphism.

   c. Validation/Verification - 
	        ensure that the solution fits the problem
		ensure that pieces of fit together correctly and there
                are no inconsistancies.

   d. Coding - code all classes and functions

   e. Code verification -  mathematical proofs on some parts and testing
      for all parts and integrate and test again

   f. submit to production - let users use it

   g. Maintenance - make corrections, make additions, and may be even redesign
      some parts.


		Sort example:
		  const int MaxSize=100;
		  void Sort (int A[MaxSize], int start_pos, int end_pos)
		  // Precondition: 
                  //    0 <= start_pos <= end_pos <= Maxsize-1
		  // Postcondition: 
                  //    A[start_pos] <= A[start_pos+1] <= A[start_pos+2] <= ...
                  //    <= A[end_pos-2] <= A[end_pos-1] <= A[end_pos]
		       


Proof of correctness, using loop invariants

int Find_Largest (int List[MaxSize], int N)
  // Precondition: 
  //   1 <= N <= MaxSize
  // Postcondition: 
  //    return value >= List[0] &&  ... && return value >= List[N-1]

{ int Largest = List[0];
  for (int i=1;i<N;i++)
     // Invariant:  Largest >= List[0] && ... && Largest >= List[i-1]
     if (Largest < List[i])
        Largest = List[i];
     // Assert: Largest >= List[0] && ... && Largest >= List[i]

  // Assert: Largest >= List[0] && ... && Largest >= List[N-1]
  return Largest
}