patternQuestions - 2009 November 23 Patterns Example Test...

Info icon This 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.
Image of page 1

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern