Name: Nazmul Hasan Shaikot ID: 1812455642 Section: 02
Name: Nazmul Hasan Shaikot ID: 1812455642 Section: 02
ID: 1812455642
Section: 02
Q1a. What design pattern(s) will you use to design the subsystem described in
lines 5-9.? Choose a maximum of three patterns (working together) for your
solution.
Ans: The design patterns I will use for the subsystem are Template pattern,
Singleton pattern and Observer pattern. Template pattern will handle all of the
tasks which are repeated like add and remove share. Singleton pattern will be
used to create an instance of the stock class. Observer pattern will notify the user
about the limitation of share.
Q1b. Draw a high-level UML class diagram of the subsystem using the design
pattern(s) you named in your answer to Q1a.
Ans:
Q2a. What design pattern(s) will you use to design the subsystem described in
lines 16-20. Choose a maximum of three patterns (working together) for your
solution.
Ans: We can use Strategy and Composite pattern for this solution. Strategy
pattern can handle the buy or metrics query operations at runtime. And the
composite pattern will help to compose objects.
Q2b. Draw a high-level UML class diagram of the subsystem using the design
pattern(s) you named in your answer to Q2a.
Ans: