SlideShare una empresa de Scribd logo
1 de 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-2012



STATE, STRATEGY, TEMPLATE METHOD and VISITORGoF PATTERNS

State, is it really easy to add new states?

It is not easy, since ConcreteState objectsbehavior depends on each other, in this sense, the
complexity of selecting the subsequent state is sparsed among all objects (the intelligence is
distributed). If we need to model this behavior, a Multi Object State Machine Diagram will be
needed, and it can become a very complex task if more states are needed.Besides,if transitions
are not controlled by some component, certain kind of anarchy may occur. As ConcreteStates are
supposed to work as a team, Observer pattern could be a possible solution that allows notifying
when object changed its state or a new object appears, aflag can be used to indicate the active
state in time, it is still not easy to increase states though, but its collaborative behavior is better
controlled.

In Strategy, the client still has to take the decision on which object to use. Template Method, is
difficult to maintain when ConcreteClasses are increased and worse if levels of hierarchy are
added. Visitor, is a wrapper with special permissions that breaks some encapsulation of the
visitees.

Más contenido relacionado

Similar a Hw8 GoF state, strategy, tempate method, visitor

Hw5 proxy, chain of responsability, command
Hw5 proxy, chain of responsability, commandHw5 proxy, chain of responsability, command
Hw5 proxy, chain of responsability, commandEdison Lascano
 
IDENTIFYING THE DAMAGE ASSESSMENT TWEETS DURING DISASTER
IDENTIFYING THE DAMAGE ASSESSMENT TWEETS DURING DISASTERIDENTIFYING THE DAMAGE ASSESSMENT TWEETS DURING DISASTER
IDENTIFYING THE DAMAGE ASSESSMENT TWEETS DURING DISASTERIRJET Journal
 
IRJET - Student Future Prediction System under Filtering Mechanism
IRJET - Student Future Prediction System under Filtering MechanismIRJET - Student Future Prediction System under Filtering Mechanism
IRJET - Student Future Prediction System under Filtering MechanismIRJET Journal
 
[SAC2014]Splitting Approaches for Context-Aware Recommendation: An Empirical ...
[SAC2014]Splitting Approaches for Context-Aware Recommendation: An Empirical ...[SAC2014]Splitting Approaches for Context-Aware Recommendation: An Empirical ...
[SAC2014]Splitting Approaches for Context-Aware Recommendation: An Empirical ...YONG ZHENG
 
IRJET - A Survey Paper on Efficient Object Detection and Matching using F...
IRJET -  	  A Survey Paper on Efficient Object Detection and Matching using F...IRJET -  	  A Survey Paper on Efficient Object Detection and Matching using F...
IRJET - A Survey Paper on Efficient Object Detection and Matching using F...IRJET Journal
 
RESUME SCREENING USING LSTM
RESUME SCREENING USING LSTMRESUME SCREENING USING LSTM
RESUME SCREENING USING LSTMIRJET Journal
 
20495-38951-1-PB.pdf
20495-38951-1-PB.pdf20495-38951-1-PB.pdf
20495-38951-1-PB.pdfIjictTeam
 
IRJET - Object Detection using Deep Learning with OpenCV and Python
IRJET - Object Detection using Deep Learning with OpenCV and PythonIRJET - Object Detection using Deep Learning with OpenCV and Python
IRJET - Object Detection using Deep Learning with OpenCV and PythonIRJET Journal
 
Access To Specific Declarative Knowledge By Expert Systems The Impact Of Log...
Access To Specific Declarative Knowledge By Expert Systems  The Impact Of Log...Access To Specific Declarative Knowledge By Expert Systems  The Impact Of Log...
Access To Specific Declarative Knowledge By Expert Systems The Impact Of Log...Audrey Britton
 
GeoAI: A Model-Agnostic Meta-Ensemble Zero-Shot Learning Method for Hyperspec...
GeoAI: A Model-Agnostic Meta-Ensemble Zero-Shot Learning Method for Hyperspec...GeoAI: A Model-Agnostic Meta-Ensemble Zero-Shot Learning Method for Hyperspec...
GeoAI: A Model-Agnostic Meta-Ensemble Zero-Shot Learning Method for Hyperspec...Konstantinos Demertzis
 
Hw4 composite decorator facade flyweight
Hw4 composite decorator facade flyweightHw4 composite decorator facade flyweight
Hw4 composite decorator facade flyweightEdison Lascano
 
Hybrid-Training & Placement Management with Prediction System
Hybrid-Training & Placement Management with Prediction SystemHybrid-Training & Placement Management with Prediction System
Hybrid-Training & Placement Management with Prediction SystemIRJET Journal
 
A Survey On Tracking Moving Objects Using Various Algorithms
A Survey On Tracking Moving Objects Using Various AlgorithmsA Survey On Tracking Moving Objects Using Various Algorithms
A Survey On Tracking Moving Objects Using Various AlgorithmsIJMTST Journal
 

Similar a Hw8 GoF state, strategy, tempate method, visitor (18)

Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Hw5 proxy, chain of responsability, command
Hw5 proxy, chain of responsability, commandHw5 proxy, chain of responsability, command
Hw5 proxy, chain of responsability, command
 
Zero Shot Learning
Zero Shot LearningZero Shot Learning
Zero Shot Learning
 
IDENTIFYING THE DAMAGE ASSESSMENT TWEETS DURING DISASTER
IDENTIFYING THE DAMAGE ASSESSMENT TWEETS DURING DISASTERIDENTIFYING THE DAMAGE ASSESSMENT TWEETS DURING DISASTER
IDENTIFYING THE DAMAGE ASSESSMENT TWEETS DURING DISASTER
 
IRJET - Student Future Prediction System under Filtering Mechanism
IRJET - Student Future Prediction System under Filtering MechanismIRJET - Student Future Prediction System under Filtering Mechanism
IRJET - Student Future Prediction System under Filtering Mechanism
 
[SAC2014]Splitting Approaches for Context-Aware Recommendation: An Empirical ...
[SAC2014]Splitting Approaches for Context-Aware Recommendation: An Empirical ...[SAC2014]Splitting Approaches for Context-Aware Recommendation: An Empirical ...
[SAC2014]Splitting Approaches for Context-Aware Recommendation: An Empirical ...
 
IRJET - A Survey Paper on Efficient Object Detection and Matching using F...
IRJET -  	  A Survey Paper on Efficient Object Detection and Matching using F...IRJET -  	  A Survey Paper on Efficient Object Detection and Matching using F...
IRJET - A Survey Paper on Efficient Object Detection and Matching using F...
 
RESUME SCREENING USING LSTM
RESUME SCREENING USING LSTMRESUME SCREENING USING LSTM
RESUME SCREENING USING LSTM
 
Database model
Database modelDatabase model
Database model
 
20495-38951-1-PB.pdf
20495-38951-1-PB.pdf20495-38951-1-PB.pdf
20495-38951-1-PB.pdf
 
IRJET - Object Detection using Deep Learning with OpenCV and Python
IRJET - Object Detection using Deep Learning with OpenCV and PythonIRJET - Object Detection using Deep Learning with OpenCV and Python
IRJET - Object Detection using Deep Learning with OpenCV and Python
 
Cognitive automation
Cognitive automationCognitive automation
Cognitive automation
 
Access To Specific Declarative Knowledge By Expert Systems The Impact Of Log...
Access To Specific Declarative Knowledge By Expert Systems  The Impact Of Log...Access To Specific Declarative Knowledge By Expert Systems  The Impact Of Log...
Access To Specific Declarative Knowledge By Expert Systems The Impact Of Log...
 
GeoAI: A Model-Agnostic Meta-Ensemble Zero-Shot Learning Method for Hyperspec...
GeoAI: A Model-Agnostic Meta-Ensemble Zero-Shot Learning Method for Hyperspec...GeoAI: A Model-Agnostic Meta-Ensemble Zero-Shot Learning Method for Hyperspec...
GeoAI: A Model-Agnostic Meta-Ensemble Zero-Shot Learning Method for Hyperspec...
 
Hw4 composite decorator facade flyweight
Hw4 composite decorator facade flyweightHw4 composite decorator facade flyweight
Hw4 composite decorator facade flyweight
 
Hybrid-Training & Placement Management with Prediction System
Hybrid-Training & Placement Management with Prediction SystemHybrid-Training & Placement Management with Prediction System
Hybrid-Training & Placement Management with Prediction System
 
A Survey On Tracking Moving Objects Using Various Algorithms
A Survey On Tracking Moving Objects Using Various AlgorithmsA Survey On Tracking Moving Objects Using Various Algorithms
A Survey On Tracking Moving Objects Using Various Algorithms
 
Data analytics
Data analytics Data analytics
Data analytics
 

Más de Edison Lascano

eXtreme Programming May Be Embedded inside Scrum
eXtreme Programming May Be Embedded inside ScrumeXtreme Programming May Be Embedded inside Scrum
eXtreme Programming May Be Embedded inside ScrumEdison Lascano
 
An Infectious Disease Surveillance Simulation (IDSS) in the Cloud
An Infectious Disease Surveillance Simulation (IDSS) in the CloudAn Infectious Disease Surveillance Simulation (IDSS) in the Cloud
An Infectious Disease Surveillance Simulation (IDSS) in the CloudEdison Lascano
 
UML for Aspect Oriented Design
UML for Aspect Oriented DesignUML for Aspect Oriented Design
UML for Aspect Oriented DesignEdison Lascano
 
Hw6 interpreter iterator GoF
Hw6 interpreter iterator GoFHw6 interpreter iterator GoF
Hw6 interpreter iterator GoFEdison Lascano
 
Hw12 refactoring to factory method
Hw12 refactoring to factory methodHw12 refactoring to factory method
Hw12 refactoring to factory methodEdison Lascano
 
Hw11 refactoringcreation
Hw11 refactoringcreationHw11 refactoringcreation
Hw11 refactoringcreationEdison Lascano
 
GoF Patterns: Prototype, Singleton, Adapter, Bridge
GoF Patterns: Prototype, Singleton, Adapter, BridgeGoF Patterns: Prototype, Singleton, Adapter, Bridge
GoF Patterns: Prototype, Singleton, Adapter, BridgeEdison Lascano
 
Abstract Factory and Builder patterns
Abstract Factory and Builder patternsAbstract Factory and Builder patterns
Abstract Factory and Builder patternsEdison Lascano
 
GoF design patterns chapters 1 and 2
GoF design patterns chapters 1 and 2GoF design patterns chapters 1 and 2
GoF design patterns chapters 1 and 2Edison Lascano
 

Más de Edison Lascano (9)

eXtreme Programming May Be Embedded inside Scrum
eXtreme Programming May Be Embedded inside ScrumeXtreme Programming May Be Embedded inside Scrum
eXtreme Programming May Be Embedded inside Scrum
 
An Infectious Disease Surveillance Simulation (IDSS) in the Cloud
An Infectious Disease Surveillance Simulation (IDSS) in the CloudAn Infectious Disease Surveillance Simulation (IDSS) in the Cloud
An Infectious Disease Surveillance Simulation (IDSS) in the Cloud
 
UML for Aspect Oriented Design
UML for Aspect Oriented DesignUML for Aspect Oriented Design
UML for Aspect Oriented Design
 
Hw6 interpreter iterator GoF
Hw6 interpreter iterator GoFHw6 interpreter iterator GoF
Hw6 interpreter iterator GoF
 
Hw12 refactoring to factory method
Hw12 refactoring to factory methodHw12 refactoring to factory method
Hw12 refactoring to factory method
 
Hw11 refactoringcreation
Hw11 refactoringcreationHw11 refactoringcreation
Hw11 refactoringcreation
 
GoF Patterns: Prototype, Singleton, Adapter, Bridge
GoF Patterns: Prototype, Singleton, Adapter, BridgeGoF Patterns: Prototype, Singleton, Adapter, Bridge
GoF Patterns: Prototype, Singleton, Adapter, Bridge
 
Abstract Factory and Builder patterns
Abstract Factory and Builder patternsAbstract Factory and Builder patterns
Abstract Factory and Builder patterns
 
GoF design patterns chapters 1 and 2
GoF design patterns chapters 1 and 2GoF design patterns chapters 1 and 2
GoF design patterns chapters 1 and 2
 

Último

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Último (20)

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Hw8 GoF state, strategy, tempate method, visitor

  • 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-2012 STATE, STRATEGY, TEMPLATE METHOD and VISITORGoF PATTERNS State, is it really easy to add new states? It is not easy, since ConcreteState objectsbehavior depends on each other, in this sense, the complexity of selecting the subsequent state is sparsed among all objects (the intelligence is distributed). If we need to model this behavior, a Multi Object State Machine Diagram will be needed, and it can become a very complex task if more states are needed.Besides,if transitions are not controlled by some component, certain kind of anarchy may occur. As ConcreteStates are supposed to work as a team, Observer pattern could be a possible solution that allows notifying when object changed its state or a new object appears, aflag can be used to indicate the active state in time, it is still not easy to increase states though, but its collaborative behavior is better controlled. In Strategy, the client still has to take the decision on which object to use. Template Method, is difficult to maintain when ConcreteClasses are increased and worse if levels of hierarchy are added. Visitor, is a wrapper with special permissions that breaks some encapsulation of the visitees.