< Day Day Up > |
The actions in the RentalOperations class introduced in Chapter 8 are definitely separate from the actions for searching a catalog. The search operations go into their own class, CatalogOperations . The only overlap is that methods in CatalogOperations need to find out if a particular CDDisc is rented, by invoking is_cd_disc_rented( ) . That method is currently in RentalOperations . Status operations do not affect a system's state. They are just reporting mechanisms for the state of an object. We split the current RentalOperations interface into two interfaces: RentalOperations and StatusOperations . The rental status operation ( is_cd_disc_rented( ) ) is placed in StatusOperations . Now, CatalogOperations needs StatusOperations , but it does not need RentalOperations , as shown in Figure 10-2. Splitting the interfaces allows us to better control the access to each function ("If You Forget Security, You're Not Secure"). The program used by a customer to perform catalog searches involves CatalogOperations , which has access to StatusOperations but not to RentalOperations . Figure 10-2. Split interfaces
|
< Day Day Up > |