14.2. A New Development
Sam called me up in an excited voice. "I've got great news."
"What? The coffee shop is having a special on double lattes?" I asked.
"Are they? I'll have to head down there," he replied. "My news is that I've hooked up with some web sites that catalog CDs. When someone gets to a CD that I have in stock, the web site posts a message telling the user that they can rent the CD at my store. I give them a cut of the rental in return."
"That sounds interesting. Are you going into the mail order rental business?" I asked.
"Not yet. But I'm getting ready," he answered. "I need you to work out the details with the web guys."
14.2.1. The Interface Contract
I called up the maintainers for one of the CD catalog sites. We discussed the interface operation and how we were going to communicate with each other. We created an interface with a single method: show_availability_of_CD_release(UPCCode upc_code). We also agreed on using Web Services as the communication protocol.
The show_availability_of_CD_release( ) method in StoreCollection is going to be exposed to the outside world. That calls for another interface, ExternalServiceProvider, to keep external services separate from internal services. The module in Sam's system that receives the request is:
interface ExternalServicesProvider
StoreExternalDTO[] show_availability_of_CD_release(UPCCode upc_code)
StoreExternalDTO parallels the Store class. We make up a separate class so that we are free to alter the internal ...