E0 257 - Software Architecture

Y. Narahari

Department of Computer Science and Automation
Indian Institute of Science
Bangalore - 560 012
INDIA


PROBLEM SET #3

  1. What is the difference between a class pattern and an object pattern?
     
  2. What is the difference between a structural pattern and a behavioural pattern? (Specific question: Why is decorator a structural pattern and not a behavioural pattern.Similarly why is strategy a behavioural pattern and not a structural pattern?)
     
  3. On page 179 of the GHJV book, the following statement is made: Decorator changes the skin of an object while Strategy changes the guts of the object. Discuss the insight in this statement.
     
  4. How do you detach responsibilities in Decorator?
     
  5. How do you dynamically switch between algorithms in the strategy pattern. What additional infrastructure do you need for this.
     
  6. Clearly understand the reason why a "bridge"pattern is used for implementing portability across windowing standards rather than an "abstract factory" pattern. This has been emphasized in the class, but be sure you got it right.
     
  7. Discuss how in the bridge pattern, a "window" object gets configured with an appropriate "windowimp" subclass? Is the abstract factory pattern useful here?
     
  8. It is required to design a web-based application for IISc admissions. A single application form is to be designed for ME,MTech, MSc (Engg), Ph D, and Int-Ph D programmes. There are common fields such as name, address, career profile, etc. and there are other fields that are unique to individual programmes. Once the candidate types in the programme (ME or M Tech etc.) on the web form, only the relevant fields much be generated by the application. Design an object model for this using appropriate design pattern(s) and write down a structural class diagram.
     
  9. A combinatorial auction is one where a seller announces the availability of a package of products for selling and prospective buyers bid for bundles (or subsets of these products). An auction object can be either a simple auction object (where only one product type is involved) or a combinatorial auction type. Once the type of the auction object type is fixed,the structure of bids and offers should conform to that auction type. Show a class diagram which can capture the main classes in such an application using design patterns.
     
  10. In the above problem, the winner determination (algorithm to decide who the winners are) depends on the type of auction. Also, for a given auction type, there could be several different ways in which winners could be determined. Furthermore, once the winners are determined, the prices they pay could be determined in a variety of ways. Use design pattern(s) to show these details could be captured in an extensible way.
     
  11. In the "Lexi" document editor case study, suppose it is required that there can only at most be 20 rows in a given column and not more than 2 colums in a page. How will you change the class diagram to relect this restriction?
     
  12. In the class, there was a question about a motivating example for decorator other than embellishments such as in Lexi. Consider the following example. We wish to electronically transfer a document on the web. The application for doing this has various options:secure transfer; transform the document into an XML documentand transfer it; transfer it in compressed form; etc. Many of these could be combined also, for example translate first into XML, then compress it, and send through secure sockets layer. In addition, each of these options could be achieved in several ways. For example, compression could be done via several algorithms (which algorithm to use could depend on nature of data). This situation can potentially use both decorator and strategy. Attempt a meaningful class diagram for this situation.



    BACK TO HOME

     Modified by: Sandhya G & Shijesta Victor on 03.11.2003