SlideShare ist ein Scribd-Unternehmen logo
1 von 1
UTAH STATE UNIVERSITY
                                        COMPUTER SCIENCE
                                    CS-7350 Reading Assignment
                             GoF Patterns: Mediator, Memento, Observer
                                        Jorge Edison Lascano
                                            Spring 2012
                                             02-01-2012
MEDIATOR, MEMENTO, OBSERVERGoFPATTERNS

Mediator, a centralizer that encapsulates communication and orchestration among several
objects by handling a cooperative behavior; interaction may be in pairs or in group.Could we
have some mediators?-Yes, we may need a mediator tree, where the root will be the main
mediator. Should we use Push or Pull techniques for managing global behavior?-It will depend
on the application, e.g. if it is a real time application, both techniques should be applied to notify
and update every object and to keep updated global state. Every object must update the
cooperative behavior.

Memento,captures and externalize an object state to let go back to previous state.The Memento
itself only contains one object state, so it needs a Caretaker to control several states. How to
ensure encapsulation?It can be done by the use of friends or in a blind way, Prototype pattern
may help, it may be expensive if little info represents the state, it would only make sense if the
whole object structure is needed to save its state, i.e. caching technique.How to implement a
complete undo feature?By using Command + Memento(s) + Iterator + Mediator(s).

Observer, Based on broadcast communication, dependent objects are told about state changes of
the others.How to tell the others about changes? By using a push/pull model, but this may
introduce a problem of uncontrolled updates (vulnerable to a kind of denial-of-service attack),
then a controller (mediator) that handles semantic rules and communication protocol must be
used. This pattern is already implemented in almost every Web 2.0 application, mainly on those
which applies AJAX, e.g. gmail.

Weitere ähnliche Inhalte

Andere mochten auch

Andere mochten auch (7)

Licencias creative commons
Licencias  creative  commonsLicencias  creative  commons
Licencias creative commons
 
Set vs Graph-based visualisations of multiple trees
Set vs Graph-based visualisations of multiple treesSet vs Graph-based visualisations of multiple trees
Set vs Graph-based visualisations of multiple trees
 
Abstract Factory and Builder patterns
Abstract Factory and Builder patternsAbstract Factory and Builder patterns
Abstract Factory and Builder patterns
 
PHP array 2
PHP array 2PHP array 2
PHP array 2
 
Menu Quen Cafe
Menu Quen CafeMenu Quen Cafe
Menu Quen Cafe
 
Tropical rainforests
Tropical rainforestsTropical rainforests
Tropical rainforests
 
エンジニア勉強会_DECIDE
エンジニア勉強会_DECIDEエンジニア勉強会_DECIDE
エンジニア勉強会_DECIDE
 

Ähnlich wie Hw7 mediator memento observer

Hw8 GoF state, strategy, tempate method, visitor
Hw8 GoF state, strategy, tempate method, visitorHw8 GoF state, strategy, tempate method, visitor
Hw8 GoF state, strategy, tempate method, visitorEdison Lascano
 
Hw5 proxy, chain of responsability, command
Hw5 proxy, chain of responsability, commandHw5 proxy, chain of responsability, command
Hw5 proxy, chain of responsability, commandEdison Lascano
 
MS Word
MS WordMS Word
MS Wordbutest
 
Tool Use Learning for a Real Robot
Tool Use Learning for a Real RobotTool Use Learning for a Real Robot
Tool Use Learning for a Real RobotIJECEIAES
 
Intelligent agents in ontology-based applications
Intelligent agents in ontology-based applicationsIntelligent agents in ontology-based applications
Intelligent agents in ontology-based applicationsinfopapers
 
Cognitive Architectures - Research Circle
Cognitive Architectures - Research CircleCognitive Architectures - Research Circle
Cognitive Architectures - Research CircleAmr Kamel Deklel
 
Rapid software evolution
Rapid software evolutionRapid software evolution
Rapid software evolutionborislav
 
Hw6 interpreter iterator GoF
Hw6 interpreter iterator GoFHw6 interpreter iterator GoF
Hw6 interpreter iterator GoFEdison Lascano
 
Exploration exploitation trade off in mobile context-aware recommender systems
Exploration  exploitation trade off in mobile context-aware recommender systemsExploration  exploitation trade off in mobile context-aware recommender systems
Exploration exploitation trade off in mobile context-aware recommender systemsBouneffouf Djallel
 
leewayhertz.com-Auto-GPT Unleashing the power of autonomous AI agents.pdf
leewayhertz.com-Auto-GPT Unleashing the power of autonomous AI agents.pdfleewayhertz.com-Auto-GPT Unleashing the power of autonomous AI agents.pdf
leewayhertz.com-Auto-GPT Unleashing the power of autonomous AI agents.pdfKristiLBurns
 
Hw4 composite decorator facade flyweight
Hw4 composite decorator facade flyweightHw4 composite decorator facade flyweight
Hw4 composite decorator facade flyweightEdison Lascano
 
Describe the need to multitask in BBC (behavior-based control) syste.pdf
Describe the need to multitask in BBC (behavior-based control) syste.pdfDescribe the need to multitask in BBC (behavior-based control) syste.pdf
Describe the need to multitask in BBC (behavior-based control) syste.pdfeyewaregallery
 
Machine Learning approach for Assisting Visually Impaired
Machine Learning approach for Assisting Visually ImpairedMachine Learning approach for Assisting Visually Impaired
Machine Learning approach for Assisting Visually ImpairedIJTET Journal
 
Introduction to Object Oriented Programming Class IX
Introduction to Object Oriented Programming Class IXIntroduction to Object Oriented Programming Class IX
Introduction to Object Oriented Programming Class IXAnsh Sam
 

Ähnlich wie Hw7 mediator memento observer (20)

Lecture 4 (1).pptx
Lecture 4 (1).pptxLecture 4 (1).pptx
Lecture 4 (1).pptx
 
Hw8 GoF state, strategy, tempate method, visitor
Hw8 GoF state, strategy, tempate method, visitorHw8 GoF state, strategy, tempate method, visitor
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, command
 
MS Word
MS WordMS Word
MS Word
 
Tool Use Learning for a Real Robot
Tool Use Learning for a Real RobotTool Use Learning for a Real Robot
Tool Use Learning for a Real Robot
 
Open modeling and simulation framework for evolutive analysis
Open modeling and simulation framework for evolutive analysisOpen modeling and simulation framework for evolutive analysis
Open modeling and simulation framework for evolutive analysis
 
Intelligent agents in ontology-based applications
Intelligent agents in ontology-based applicationsIntelligent agents in ontology-based applications
Intelligent agents in ontology-based applications
 
Cognitive Architectures - Research Circle
Cognitive Architectures - Research CircleCognitive Architectures - Research Circle
Cognitive Architectures - Research Circle
 
Rapid software evolution
Rapid software evolutionRapid software evolution
Rapid software evolution
 
Hw6 interpreter iterator GoF
Hw6 interpreter iterator GoFHw6 interpreter iterator GoF
Hw6 interpreter iterator GoF
 
Exploration exploitation trade off in mobile context-aware recommender systems
Exploration  exploitation trade off in mobile context-aware recommender systemsExploration  exploitation trade off in mobile context-aware recommender systems
Exploration exploitation trade off in mobile context-aware recommender systems
 
leewayhertz.com-Auto-GPT Unleashing the power of autonomous AI agents.pdf
leewayhertz.com-Auto-GPT Unleashing the power of autonomous AI agents.pdfleewayhertz.com-Auto-GPT Unleashing the power of autonomous AI agents.pdf
leewayhertz.com-Auto-GPT Unleashing the power of autonomous AI agents.pdf
 
Smart-X: an Adaptive Multi-Agent Platform for Smart-Topics
Smart-X: an Adaptive Multi-Agent Platform for Smart-TopicsSmart-X: an Adaptive Multi-Agent Platform for Smart-Topics
Smart-X: an Adaptive Multi-Agent Platform for Smart-Topics
 
Hw4 composite decorator facade flyweight
Hw4 composite decorator facade flyweightHw4 composite decorator facade flyweight
Hw4 composite decorator facade flyweight
 
CS4700-Agents_v3.pptx
CS4700-Agents_v3.pptxCS4700-Agents_v3.pptx
CS4700-Agents_v3.pptx
 
Describe the need to multitask in BBC (behavior-based control) syste.pdf
Describe the need to multitask in BBC (behavior-based control) syste.pdfDescribe the need to multitask in BBC (behavior-based control) syste.pdf
Describe the need to multitask in BBC (behavior-based control) syste.pdf
 
Machine Learning approach for Assisting Visually Impaired
Machine Learning approach for Assisting Visually ImpairedMachine Learning approach for Assisting Visually Impaired
Machine Learning approach for Assisting Visually Impaired
 
human_factors_03.ppt
human_factors_03.ppthuman_factors_03.ppt
human_factors_03.ppt
 
Introduction to Object Oriented Programming Class IX
Introduction to Object Oriented Programming Class IXIntroduction to Object Oriented Programming Class IX
Introduction to Object Oriented Programming Class IX
 
From Self-Organising Mechanisms to Design Patterns
From Self-Organising Mechanisms to Design PatternsFrom Self-Organising Mechanisms to Design Patterns
From Self-Organising Mechanisms to Design Patterns
 

Mehr von 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
 
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
 
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
 

Mehr von Edison Lascano (8)

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
 
Soap and Rest
Soap and RestSoap and Rest
Soap and Rest
 
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
 
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
 

Kürzlich hochgeladen

UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 

Kürzlich hochgeladen (20)

UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 

Hw7 mediator memento observer

  • 1. UTAH STATE UNIVERSITY COMPUTER SCIENCE CS-7350 Reading Assignment GoF Patterns: Mediator, Memento, Observer Jorge Edison Lascano Spring 2012 02-01-2012 MEDIATOR, MEMENTO, OBSERVERGoFPATTERNS Mediator, a centralizer that encapsulates communication and orchestration among several objects by handling a cooperative behavior; interaction may be in pairs or in group.Could we have some mediators?-Yes, we may need a mediator tree, where the root will be the main mediator. Should we use Push or Pull techniques for managing global behavior?-It will depend on the application, e.g. if it is a real time application, both techniques should be applied to notify and update every object and to keep updated global state. Every object must update the cooperative behavior. Memento,captures and externalize an object state to let go back to previous state.The Memento itself only contains one object state, so it needs a Caretaker to control several states. How to ensure encapsulation?It can be done by the use of friends or in a blind way, Prototype pattern may help, it may be expensive if little info represents the state, it would only make sense if the whole object structure is needed to save its state, i.e. caching technique.How to implement a complete undo feature?By using Command + Memento(s) + Iterator + Mediator(s). Observer, Based on broadcast communication, dependent objects are told about state changes of the others.How to tell the others about changes? By using a push/pull model, but this may introduce a problem of uncontrolled updates (vulnerable to a kind of denial-of-service attack), then a controller (mediator) that handles semantic rules and communication protocol must be used. This pattern is already implemented in almost every Web 2.0 application, mainly on those which applies AJAX, e.g. gmail.