O'Reilly logo

Java™ Design Patterns: A Tutorial by James W. Cooper

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 36. Mary's Dilemma

Herb finished his Chain of Responsibility development and made the framework available for the rest of his project group. One of his first users was Mary, who suddenly discovered that she had a number of additional requirements that Herb's chain did not fulfill. She wanted to be able to produce summaries of each document.

"For example," she told Sandy, "I need to keep sentence numbers and word numbers of every term that we find in a document. Herb has that information, but he doesn't store it anywhere."

"Why don't you subclass Herb's classes and store the data in whichever class you need it?" asked Sandy.

"I don't know what else I'll need until Ifinish developing the algorithms, and I don't want to take a chance that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required