1. Draw a class diagram of the with these elements: Factory Method Pattern ConcreteFactory, ConcreteProduct, makeProduct( ) Factory (interface), Product (interface), Show relationships between elements. 2. and use the Factory Method pattern. For example: Iterable Iterator ArrayList list = new ArrayList(); list.add( "apple" ); list.add( "banana" ); . . . Iterator iter = list.iterator( ); Complete the table to show how this example uses the Factory Method pattern Name in Pattern Name in This Example Factory Product ConcreteFactory ConcreteProduct makeProduct( ) 3. The purpose of the Command Pattern is to encapsulate actions so that we can have a family of interchangeable actions, like "turn on", "turn off", or "play sound". The digital clock uses as Timer and TimerTask to update the time and another TimerTask to sound the alarm (at least, you program it that way... don't check the alarm time every second!). should a) Fill in the table: Name in Pattern Name in this example
1. Draw a class diagram of the Factory Method Pattern with these elements: Factory (interface), Product (interface), ConcreteFactory, ConcreteProduct, makeProduct( ) Show relationships between elements. 2. Iterable and Iterator use the Factory Method pattern. For example: ArrayList list = new ArrayList(); list.add( "apple" ); list.add( "banana" ); . . . Iterator iter = list.iterator( ); Complete the table to show how this example uses the Factory Method pattern Name in Pattern Name in This Example Factory Product ConcreteFactory ConcreteProduct makeProduct( ) 3. The purpose of the Command Pattern is to encapsulate actions so that we can have a family of interchangeable actions, like "turn on", "turn off", or "play sound". The digital clock uses as Timer and TimerTask to update the time and another TimerTask to sound the alarm (at least, you should program it that way... don't check the alarm time every second!). a) Fill in the table: Name in Pattern Name in this example
Patterns-Exercises.docx