The online bookstore system needs to display different messages and enable/disable different buttons in the main window according to different types of users. The class diagram below shows the way of handling the differences by applying the Polymorphism Pattern in the GRASP collection.
(a) (20) As the Bridge Pattern in the GoE collection is able to decouple an abstraction from its implementation for the two to vary independently, draw a class diagram to show the application of the Bridge Pattern for this given problem.
(b) (6) Use C#/Java codes to explain how your classes based on the Bridge Pattern can be used to handle the differences of this given problem.
RegularUser
Attributes
Operations PrepareMessage() VisibleButton()
UserData
MainWindow
Attributes Operations PrepareMessage() VisibleButton()
UserOwner
Attributes
Operations PrepareMessage() VisibleButton()