In this recitation, you will revisit three crucial design patterns: Strategy, Template, and Decorator. For each pattern, your task is to articulate key aspects, discuss scenarios where it is beneficial, highlight situations where it might not be the best choice, and demonstrate their use in UML diagram in the context of Santorini's God Cards.
- Fill out the Strategy pattern template and answer follow-up questions of the TA
- Fill out the Template pattern template and answer follow-up questions of the TA
- Fill out the Decorator pattern template and answer follow-up questions of the TA
Throughout the semester, we've delved into many commonly used design patterns, including Strategy, Template, Decorator, Composite, Observer, Proxy, and Adapter.
In this lab, we will focus on the first three.
For each design pattern, you are expected to provide information in four sections:
- Description: Define the key characteristics that distinguish the pattern from others.
- Pros: Explain when and why you would choose this pattern. Focus on its advantages in terms of design principles and coding styles.
- Cons: Identify scenarios where choosing this pattern might be suboptimal. Focus on what makes it less preferable compared to alternative choices.
- UML Diagram/Code snippet: Draw an excerpt of a UML object model illustrating how you could use the design pattern to implement God Cards in Santorini. The model should show concrete classes that are plausible in the game, but an excerpt with only a small subset of methods or fields is fine, as long as it demonstrates the pattern.
- Create a copy of the template at https://docs.google.com/document/d/1o-j6jTDt1VLfUzJaF_kp-3blUSpXp-U7BGSPdN4vt08/edit?usp=sharing
- Strive to devise your explanations before consulting external sources.
- While you are only required to explain three design patterns to the TA, feel free to continue filling in the information for the remaining patterns and seek clarification or assistance from the TA if needed.