SlideShare une entreprise Scribd logo
1  sur  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.

Contenu connexe

Similaire à 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
 

Similaire à 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
 

Plus 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
 

Plus 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
 

Dernier

Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
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
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
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
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
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
 
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
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 

Dernier (20)

Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
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)
 
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
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 

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.