Hw8 GoF state, strategy, tempate method, visitor
Upcoming SlideShare
Loading in...5
×
 

Hw8 GoF state, strategy, tempate method, visitor

on

  • 256 views

GoF Patterns: State, Strategy, Template Method and Visitor

GoF Patterns: State, Strategy, Template Method and Visitor

Statistics

Views

Total Views
256
Views on SlideShare
256
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Hw8 GoF state, strategy, tempate method, visitor Hw8 GoF state, strategy, tempate method, visitor Document Transcript

  • 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.