CRC Cards for the Address Book Example

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.


Class AddressBook

The CRC Cards for class AddressBook are left as an exercise to the student

[ Links for this class ]


Class AddressBookController

The basic responsibility of an AddressBookController object is to carry out the various use cases.

ResponsibilitiesCollaborators
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 Find Use Case AddressBook
Allow the user to perform the Find Again 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

[ Links for this class ]


Class AddressBookGUI

The basic responsibility of a GUI object is to allow interaction between the program and the human user.

ResponsibilitiesCollaborators
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.
Maintain the state of the "Find Again" menu option - usable only when the last Find operation was successful and the address book has not been change subsequently
Allow the user to request the performance of a use case AddressBookController

[ Links for this class ]


Class FileSystem

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.

ResponsibilitiesCollaborators
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

[ Links for this class ]


Class Person

The basic responsibility of a Person object is to maintain information about a single individual.

ResponsibilitiesCollaborators
Create a new object, given an individual's name, address, city, state, ZIP, and phone
Furnish the individual's full 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

[ Links for this class ]


Page of links for non frames-enabled browsers.

Valid XHTML 1.0!

Copyright © 2005 - Russell C. Bjork. Permission for non-commercial reproduction for educational use is hereby granted; all other rights are reserved.