Homework 3

Due Tue Sep 29, 5 points

For this assignment you only need to turn in answers for the questions that have a point count. Other questions should be given some thought and will be useful for review.

  1. (1 point) What is is the difference between primitive operations and hook operations in the Template Method design pattern?

  2. (1 point) Both the Template Method and Strategy design patterns aim to simplify adapting code to a variety of algorithms. Which is more flexible in terms of supporting dynamic (runntime) changes? Is this always desireable?

  3. (1 point) How is the Memento design pattern implemented in Java? That is, how do solve the problem described in the "language support" issue of the "Imlementation" section in GHJV?

  4. (1 points) What is the intent of the Iterator design pattern?

  5. How are the Memento and Iterator design patterns related?

  6. Briefly describe the solution in the Facade design pattern?

  7. (1 point) All of the design patterns that we have discussed so far except Facade make use of interface inheritance. Which of them make use of implementation inheritance in an essential way?