Observer Pattern Class Diagram Observer Pattern Sequence Diagram Current Blackjack C 2863558

Observer class diagram.png

Observer Pattern Class Diagram

Observer sequence diagram.png

Observer Pattern Sequence Diagram

Blackjack class diagram.png

Current Blackjack Class Diagram

Purpose

This exercise is intended to give you experience with another Design Pattern, the Observer Pattern, a Behavioral pattern.

What to Hand In

For each of the problems, create a document with the requested content. Each document must contain your name, the exercise number, and the course name at the top. Submissions must be clear and to the point, and should be expressed in properly constructed English sentences. Be sure that any references used are properly credited using the University College required citation format.

Diagrams may be provided using any tool of the student’s choice. However, whatever tool you use you must embed the diagram into a PDF file in order to submit it.

Canvas submission instructions:
Please combine multiple files into a single “zip” archive, and save it in a location that you will remember. When you are ready to submit the assignment, open the assignment you are submitting a solution for, and attach your file.

Document format: PDF files are REQUIRED for ALL assignment submissions. Assignments submitted in any other format will not be graded and will receive zero credit.

  • NO Word documents;
  • NO Powerpoint presentations;
  • NO OpenOffice documents;
  • NO image files;
  • NO other formats

Problems

  1. Class Diagram
    1. Modify the UML class diagram above to adapt and incorporate the Observer Pattern, as described above, and implement the relationships needed to allow it to work.
      Ensure you include all the properties and methods needed for the Observer Pattern.
  2. Sequence Diagram
    1. Create a UML sequence diagram with a Dealer, two Players (one who cares about observing the cards inserted in the Hands [Aggressive Player], and one who doesn’t [Standard Player]), a Hand for the Dealer and each Player, and any other lifelines you need. Be sure to include the exchanges that reflect the use of the Observer Pattern.
      The sequence diagram should start with the Dealer dealing cards and end after both Players have had a turn, where a turn for a Player ends when the player is either bust or passes.
      The sequence diagram may be for a specific scenario, so loops and alternatives can be avoided, if you wish. However, if you do so, then you must include the card values on the method calls so that it makes sense.
  3. Discussion
    1. Write up a 1-2 page paper explaining your solution and your design choices. Imagine you’re writing it to your coworkers to explain why this is a good idea.
  4. Extra credit [OPTIONAL]
    1. The author of the class diagram was overly fond of inheritance. Update the diagram to avoid some of the use of inheritance in favour of other patterns that we have discussed. Note that this doesn’t mean you shouldn’t use inheritance, just to make better use of it.
    2. Write up your changes in a 1-2 page paper that explains your thinking and why your solution is preferable.

Notes

  • For Problem 1, any classes, properties, or methods not needed for the Observer Pattern, and which are the same as provided above, need not be included in the solution.
  • For Problem 2, note that the Subject and the ConcreteObservers are classes (with other names) that are already in the Blackjack Class Diagram. There is also a class that one could use for the Observer although it is suboptimal. You could either use an existing class and explain the problems or else add your own. Either way be sure to explain your thinking.
  • For consistency’s sake, please use the property names and method names in the Observer Pattern diagram above on your Class Diagram and Sequence Diagram.
  • Please take a little extra time to ensure that your diagram corresponds to UML notation.

Prof. Angela

4.6/5

Calculate Price


Price (USD)
$