Lab - Interfaces

Okay, just follow along, questions will be denoted with a Q.

Interfaces

Q 1 Describe what is meant by each of the following:

  1. Hide implementation details
  2. Choose a small orthogonal set of primitives
  3. Don't reach behind the user's back
  4. Do the same thing the same way everywhere

CSV implementation

Q 2 What are the problems w/the first implementation in C (Labs/Interfaces/csvgetline1.c)?

Q 3 What things were improved upon in the first revision in C?

Q 4 What problems does the first revision (Labs/Interfaces/csvgetline2.c) still have? Can you parse 2 different CSV files at the same time? Explain.

Q 5 Does the C++ implementation solve these problems? What issues still remain?

Q 6 Does the interface for the C++ implementation adhere to our guidelines for a good i/f, from lecture?

Q 7 Re-write csvgetline2.c so that you can parse more than one file. You'll accomplish this by moving the globals associated with parsing a line into a struct (see csv.h. To make it behave more like the C++ version, I added a FILE* field. I also wrote stack_init and kill functions . The main function is the same as previously, and resides in main.c . I also provided a makefile.

Find these files under the lab directory:

By way of example I provided an implementation of a stack. See Labs/interfaces/Stack . You can have numerous independent stacks.