11.1. Adaptation

Sam stopped by for coffee. "You know, I forgot one thing."

"What's that?" I asked.

"I'd really like to keep customers' addresses in the database," he said.

"Well, we don't have a database. That's an implementation issue you shouldn't be concerned with," I replied.

"OK, you got me. I want to be able to keep track of a customer's address so that I can send him mail," Sam stated.

"I think we can do that. You can have the staff enter each customer's address off your cards," I said.

"Yeah, but I also want to check whether my staff entered the addresses correctly. If they enter the wrong Zip Code, the post office might send the mail back. That's a waste," he stated emphatically.

"OK, we'll put Zip Code verification into the CD rental system," I said. "I'll look for a Zip Code verification system."

Then I asked, "What should the system do if the Zip Code is incorrect?"

He said, "Correct it," looking at me as if I were asking the dumbest question he had heard in the last year.

I followed it up with, "What should the system do if the Zip Code cannot be found?"

"Then I guess the user must have made a mistake, so we ought to ask him to correct it," he answered.

"What if the address is not in the Zip Code system yet?" I asked.

"Well, maybe you should keep track of that and try verifying it later," Sam replied.

Based on his responses, I came up with the following preliminary work case for the Zip Code verification system. A work case, as you might recall from Chapter 4 ...

Get Prefactoring now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.