Recitation 9

  1. A bounded queue is a queue whose maximum capacity is bounded at the time it is created; they frequently appear in operating systems as ring buffers. Develop a signature for bounded queues, including specification comments. Some interesting pieces of the design include:

    • options vs. exceptions,

    • the need for an is_full function, and

    • the function for creating an empty queue.

  2. Reflect on a time when you encountered a specification that you needed to implement, but you felt it was ambiguous. Perhaps a programming assignment in this class or another class would serve as an example. Describe the situation—you can omit the course number :)—and how you coped with it.

    In retrospect, which of these factors (or maybe others) played a role?

    • The client didn’t understand what they wanted you to implement, hence gave you a bogus spec.

    • The spec was clear, but only after you came to understand the meaning of some piece of it better.

    • The client genuinely didn’t care about some aspect of the implementation, so left it unspecified.

    What strategies might you follow in the future when you encounter specs that you do not initially understand?