
Name __________________________________________
Answer all 10 questions. Answer essay questions as briefly as possible.
The following might be names of patterns:! Abstract Class, Abstract Factory, Adapter,
Application Controller, Bridge, Builder, Chain of Responsibility, Collaborator, Command,
Composite, Decorator, Façade, Factory Method, Flyweight, Interpreter, Iterator, Master-
Slave, Mediator, Memento, Null Object, Observer, Prototype, Proxy, Singleton,
Specification, State, Strategy, Template Method, Visitor.
1. Suppose you were designing the file system of an operating system.
A. The file system has tree-structured directories.! Which design pattern is indicated
by the tree structured directories?
B. Suppose your system should be able to implement many kinds of file systems.!
A Linux file system has Linux directories and Linux files, while a BSD file system
and an NT file system have their own ways of representing directories and files.!
You want to be able to write reusable algorithms for the file system, but when
these algorithms are creating directories and files, they will create them for Linux,
BSD, or NT as appropriate.! Which design pattern would help you create objects
of the right class?
2. The purpose of many of the design patterns is to make it easy to change some
property of the system.! What design pattern would you use to make it easy to
change:
A. The algorithm that an object uses
B. The number of objects that need to be notified when an object changes state
C. Adding operations to classes without changing the class
2/16/10"CS 635 Midterm Exam"Page 1 of 2