Question 3. Describe briefly a concrete application scenario in which the Faade and Strategy design patterns can be used together to improve software design. Draw a simple class diagram to show your proposed software design.
Question 4. Suppose you have to provide two implementations (A and B) of the same data structure (e.g., a graph). A is better in some situations while B outperforms A in other situations. What is a typical OO design in this situation (assuming no knowledge of design patterns)? How would you do differently after learning the design patterns? Which design pattern is particularly helpful in this situation?
Question 5. Consider the application of international e-commerce, which we discussed extensively in class meetings. We have focused on dealing with differing international rules for calculating taxes. Now you are asked to extend that solution to deal with another aspect of doing business internationally online: depending on the location of the consumers, the system is supposed to automatically convert the price into the local currency and display it. Draw a class diagram to illustrate your solution. Provide a skeleton implementation in Java.
Question 1. Briefly explain what we mean by favoring aggregation over inheritance.
Question 2. Think of a simple business application scenario which can benefit from the bridge pattern. Very briefly state the scenario and draw a UML diagram to show your bridge pattern-based software design.
Question 3. Consider the application of international e-commerce. Depending on location of the consumers assuming we are only dealing with consumers from US, Canada, and UK), your system is supposed to automatically convert the price into the local currency and display it. Use the Abstract Factory design pattern to design a subsystem that handles proper initiation of the objects taking care of these price conversions and display. Draw a UML diagram to illustrate your solution. Provide a skeleton implementation in Java.
Question 1. This question extends the last question from Assignment 5. Use the Singleton pattern to make sure that these objects are instantiated at most once. Draw a UML diagram and provide a skeleton implementation in Java.
Question 2. You are developing a security system for an airport. For the time being, your system will manage gate security only. For any alarms triggered at the gate, the system needs to automatically notify the following subsystems: airPortSecurity, airLine, localPolice. Each of these subsystems will take appropriate actions based on the alarm. Use the publisher-subscriber design pattern to come up with a software design for the above application. Draw a UML diagram and provide a skeleton implementation in Java.
Question 3. Briefly describe one business scenario (e.g., extension to various examples we discussed in class and your own project), in which a messaging-based loosely-coupled design will make sense. There is no need for you to come up with the actual design. Just make pertinent arguments (at the conceptual level) about the critical need for the messaging-based approach in these scenarios.