Tute Exercises Week 10
Modules
This week's tute and lab exercises are based on the address book example
discussed in the lecture.
Modular Design
The following interfaces and (incomplete) modules implement the
module structure for the application as discussed in the lecture.
- Which modules will be affected if we extend the definition of
Address?
- In the current version, Address is exported with its
constructors, since the user interface module needs the
informations to construct, read and print addresses. Assume an
address will always consist of at least first name, last
name and telephone number. Change the interface of
AddressDB such that altering the definition of
Address does not directly affect other modules. What are
the disadvantages of such a solution?
- Design a new type Address which, in addition to the
fields of the current type, has the following optional
fields:
- Street Name and number (as one string)
- City
- Post code
- State
and provide functions to set these fields.