1. UTAH STATE UNIVERSITY COMPUTER SCIENCE CS-7350 Reading Assignment GoF Patterns: State, Strategy, Template Method and Visitor Jorge Edison Lascano Spring 2012 01-27-2012STATE, STRATEGY, TEMPLATE METHOD and VISITORGoF PATTERNSState, is it really easy to add new states?It is not easy, since ConcreteState objectsbehavior depends on each other, in this sense, thecomplexity of selecting the subsequent state is sparsed among all objects (the intelligence isdistributed). If we need to model this behavior, a Multi Object State Machine Diagram will beneeded, and it can become a very complex task if more states are needed.Besides,if transitionsare not controlled by some component, certain kind of anarchy may occur. As ConcreteStates aresupposed to work as a team, Observer pattern could be a possible solution that allows notifyingwhen object changed its state or a new object appears, aflag can be used to indicate the activestate in time, it is still not easy to increase states though, but its collaborative behavior is bettercontrolled.In Strategy, the client still has to take the decision on which object to use. Template Method, isdifficult to maintain when ConcreteClasses are increased and worse if levels of hierarchy areadded. Visitor, is a wrapper with special permissions that breaks some encapsulation of thevisitees.