CSCI 5828

Foundations of Software Engineering

Course Location
   1B 28

Course Time
   Tuesday and Thursday
   11:00 AM - 12:15 PM

Topics
   What's New (Home)
   Class Schedule
   Lectures
   Assignments
   Student Comments
   Contact Information
   Evaluation Criteria
   Status Reports

What's New Archives
   January, 1999
   February, 1999
   March, 1999

CSCI 5828 Homework 3: Programming with Assertions

In-Class Due Date: Lecture 22, April 1, 1999

CATECS Due Date: April 8, 1999

Format for Assignment: Plain ASCII text, in the body of an e-mail message

Assignment

Read the following paper:

D. S. Rosenblum. "A Practical Approach to Programming with Assertions. IEEE Transactions on Software Engineering, 21(1):19-31, January 1995.

Answer the following questions:

  1. What are two examples of how APP has been integrated with C?

  2. What is the difference between using APP and inserting your own print statements into the code?

  3. APP currently works on C. C++ extends C with the concept of the "class". Briefly describe how you might think APP would need to be extended to handle C++ classes.

  4. Below is Euclid's algorithm for finding the greatest common divisor.

    function GCD (x: pos-integer; y: pos-integer) return pos-integer is
    begin

    while x != y loop
    if x > y then
    x := x - y;
    else
    y := y - x;
    end if;
    end loop;
    return x;
    end GCD;

    a. Add assume and return annotations to the algorithm.

    The return annotation is actually quite interesting, since it essentially defines the meaning of "greatest common divisor" as an axiomatic expression. One approach is to ensure that no integer between the common divisor and the smaller of the two input values wil divide both of the two input values.

    b. If you were to take the approach described above to specifying the return annotation, it would be pretty heavy handed, and could add substantial overhead to the program. Once you gained confidence in the correctness of your implementation, you might want to be able to turn checking off. What mechanism does APP provide to let you do that?

    c. Why is it not necessary to write any promise annotations for this algorithm?


© Ken Anderson, 1999.
Last Updated: 8/16/00; 2:45:56 PM