Question: Please help with Software Design/Pattern Oriented Design question with a Class Diagram and Interaction Diagram. The course is: Pattern Oriented Design (SWENG 585) - PSU
Please help with Software Design/Pattern Oriented Design question with a Class Diagram and Interaction Diagram.
The course is: Pattern Oriented Design (SWENG 585) - PSU
Consider the design given below: Light Switch + turn On + turn OFF Two of the design principles are clearly being violated by this design: the Dependency-Inversion Principle (DIP) and the Open-Closed Principle (OCP). The dependency from Switch to a concrete class Light violates DIP and the same dependency violates OCP because it forces us to drag a Light along everywhere we need a Switch (for example, to turn off/on a Fan) making it harder to extend. Single Responsibility Principle (SRP) may also be violated since Switch and Light being bound together are forced to change together yet there may be situations we have no have no control over Light; it may be a third party product! Can you suggest a solution that satisfies OCP, DIP and SRP? Please include the following diagrams and their description in your solution: 1. A design class diagram that shows all the classes and their association. 2. An interaction diagram that shows how a device (such as a Fan or a Light) is turned on or off. Please be clear and specific in your descriptionsStep by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
