Give two short exam questions (and solutions) about your topic.
Question #1: During the course of development we have decided that we want to change the look of the scrollbar. Why would using the composite design pattern be an incorrect choice here? What is the correct Design Pattern?
Solution #1: The idea behind the composite design pattern is to group primitive objects together and treat them as a single object. The correct design pattern would be decorator. They both have a similiar format, but the decorators intent is to change the look of a component without changing its function.
Question #2: You were tasked with building the logic behind the placement of objects on a java GUI. You know you want a variety of different ways to place objects on the window but you want a common interface among them. What would be the best discussed design pattern to use here?
Solution #2: Strategy would be the best design pattern to use since the intent is to use a variety of different ways to achieve the same goal. In this case the layout of a frame.