Responsibilities are assigned to the various classes based on the use of the model-view-controller design pattern. The two entity classes (AddressBook and Person) serve as the model. The GUI class (AddressBookGUI) serves as the view. The controller class (AddressBookController) serves, of course, as the controller.
The view (AddressBookGUI) needs to be made an observer of the model (specifically, AddressBook) so that it always reflects the current state of the model - specifically, the list of names, the title, and its saved/needs to be saved status.
Using CRC cards to assign responsibilities to various classes for the tasks required by the various use cases leads to the creation of the following cards.
The basic responsibility of an AddressBookController object is to carry out the various use cases.
Responsibilities | Collaborators |
---|---|
Allow the user to perform the Add a Person Use Case | AddressBook |
Allow the user to perform the Edit a Person Use Case | AddressBook |
Allow the user to perform the Delete a Person Use Case | AddressBook |
Allow the user to perform the Sort Entries by Name Use Case | AddressBook |
Allow the user to perform the Sort Entries by ZIP Use Case | AddressBook |
Allow the user to perform the Create New Address Book Use Case | AddressBook |
Allow the user to perform the Open Existing Address Book Use Case | FileSystem |
Allow the user to perform the Save Address Book Use Case | AddressBook FileSystem |
Allow the user to perform the Save Address Book As ... Use Case | FileSystem |
Allow the user to perform the Print Entries Use Case | AddressBook |
Perform the Offer to Save Changes Extension when needed by another Use Case | AddressBook |
The basic responsibility of a GUI object is to allow interaction between the program and the human user.
Responsibilities | Collaborators |
---|---|
Keep track of the address book object it is displaying | |
Display a list of the names of persons in the current address book | AddressBook |
Display the title of the current address book - if any | AddressBook |
Maintain the state of the "Save" menu option - usable only when the address book has been changed since the last time it was opened / saved. | AddressBook |
Allow the user to request the performance of a use case | AddressBookController |
The basic responsibility of a FileSystem object is to manage interaction between the program and the file system of the computer it is running on.
Responsibilities | Collaborators |
---|---|
Read a stored address book from a file, given its file name | AddressBook |
Save an address book to a file, given its file name | AddressBook |
The basic responsibility of a Person object is to maintain information about a single individual.
Responsibilities | Collaborators |
---|---|
Create a new object, given an individual's name, address, city, state, ZIP, and phone | |
Furnish the individual's first name | |
Furnish the individual's last name | |
Furnish the individual's address | |
Furnish the individual's city | |
Furnish the individual's state | |
Furnish the individual's ZIP | |
Furnish the individual's phone number | |
Update the stored information (except the name) about an individual |
Page of links for non frames-enabled browsers.