patternQuestions

patternQuestions - 2009 November 23 Patterns Example Test...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
2009 November 23 Patterns Example Test Questions 1. The Composite design pattern is used to compose classes into tree structures in order to represent containment relationships. The pattern lets you treat objects and compositions of objects in the same way. Use the Composite pattern, together with BON, to model the notion of a folder in Windows XP. Folders may be nested, and may also contain text files and binary files. Files may be opened, closed, and drawn on the screen. Folders may also have items added to and removed from them. Draw a static BON diagram modeling this notion. Show the interface of each class. 2. In a few sentences, explain the intent and motivation of the Builder pattern. Give an example of its use, drawn using BON. Do not show the general structure of the pattern; show how it might be used in a real software system. 3. The Observer design pattern is used to define a many-to-one dependency among objects. When one object (called a subject) changes its state, all of its dependents are notified and are updated automatically. Use the observer pattern in BON to model a network file system, which consists of a remote server and a number of client personal computers. Using BON, represent the remote server and the clients as classes and draw their interactions, so that the server and the clients satisfy the observer pattern (i.e. . clients are notified of changes to the server). You may use BON static and dynamic models, as well as simple contracts, to make your design clear. 4. In this question you are expected to use your knowledge on design patterns to suggest a solution for a given scenario. For each of the following scenarios, state which design pattern(s), of the ones described in the course, can best solve the problem. Describe how you would use the patterns (which pattern participants are responsible for doing what) to solve the problem. Briefly identify and discuss related issues. Only high-level descriptions are required. You do not need to provide pattern details. A A set of cities is maintained as an interconnected graph structure. A web based application needs to maintain multiple views of the distances between cities. Assume that the GRAPH class provides operations for obtaining the distance between any two cities. New roads are always constructed between cities and as a result the distances change. One view provides a table of distances between cities in kilometers, and another view maintains the same information in miles. B
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/14/2012 for the course CSE 3214 taught by Professor Ross during the Winter '12 term at York University.

Page1 / 6

patternQuestions - 2009 November 23 Patterns Example Test...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online