
Name __________________________________________
Answer all 9 questions. Answer essay questions as briefly as possible.
The following might be names of patterns:! Abstract Class, Adapter, Bridge, Builder, Chain of
Responsibility, Collaborator, Command, Command Processor, Composite, Decorator, Factory
Method, Flyweight, Interpreter, Iterator, Mediator, Memento, Null Object, Observer, Prototype,
Proxy, Singleton, Specification, State, Strategy, Template Method, Visitor.
1. The text claims that design patterns help overcome some common causes of redesign of a
system. What pattern would you use to handle the following issues.
A. Algorithmic dependencies.
B. Inability to alter classes conveniently.
2. Why does the Big Ball of Mud pattern suggest postponing working on architecture when
developing software?
3. Assume we have a method called trimBlanks() on the String class that removes all leading
and trailing spaces. That is it repeatedly removes the first character of the string as long as
it is a space and repeatedly removes the last character of the string as long as it is a space.
Write XUnit (where X = J, R, C#, Cpp) test(s) for the method. C++ people can assume that
all C++ strings are an instance of the String class.
4. Explain.
A. Information Hiding
B. Encapsulation
C. Abstraction
5. What are the advantages and disadvantages of the Null Object pattern.
5/14/09"CS 635 Midterm Exam"Page 1 of 2