10.3. Interface Development

 <  Day Day Up  >  

Sam and I did not have much time to discuss the new use cases introduced at the beginning of this chapter. The original Search_catalog use case in Chapter 4 seems to imply that the search should return only CDCatalogItem s that Sam carries in inventory. Should that filtering be part of the CDCatalogItemCollection interface or should it be done on the list of CDCatalogItem s that the interface returns?

Considering separation of concerns simplifies our decision. The job of the CDCatalogItemCollection interface is to find all CDCatalogItem s that meet the search criteria for each method. The concern of another class, CDCatalogItemInStoreCollection , is to determine which CDCatalogItem s correspond to CDRelease s. The interface for CDCatalogItemInStoreCollection looks the same as that for CDCatalogItemCollection . CDCatalogItemInStoreCollection is responsible for checking that the UPCCode for each CDCatalogItem exists in the CDReleaseCollection and returns only CDCatalogItem s for which that was true. Figure 10-1 shows the sequence diagram for a search using CDCatalogItemInStoreCollection .

Figure 10-1. CDCatalogItemInStoreCollection sequence diagram

To check the usability of the search interface, Tim and I create a small class that implements the CDCatalogItemCollection interface and returns data for a very small number of CDCatalogItem s and Song s. Text files are used to store the data so that it can be changed easily. Corresponding graphical user interface (GUI) displays are created to drive the interface. Then the prototype implementation is exercised to see how well the interface matches the user 's expectations ("Prototypes Are Worth a Thousand Words").

 <  Day Day Up  >  


Prefactoring
Prefactoring: Extreme Abstraction, Extreme Separation, Extreme Readability
ISBN: 0596008740
EAN: 2147483647
Year: 2005
Pages: 175
Authors: Ken Pugh

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net