Modular Programming

An introduction to the "Rational Arithmetic" programming assignment

Recommended Reading:

Sedgewick pages 166-171

1. Interface

- defines data structure

- declares functions to be used to manipulate data structure

2. Implementation

- actual code for the functions declared in interface

- you may have more than one implementation for the same interface

3. Client

- a program that uses functions declared in interface (without 'knowledge' of how they are implemented)

- multiple, separate clients can use the same interface


your 'first' client:

Your first client program should be a 'debug' client. A debug client tests each of the functions provided in the interface. As you write the code for ("implement") each function in the interface, test it with the debug client.

HINT: It's a good idea to write a 'show' or 'print' function to display data (in this case, rational numbers), even if you won't need it in your final program.

Question: What are some benefits of modular programming?