SlideShare a Scribd company logo
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.

More Related Content

Viewers also liked

Licencias creative commons
Licencias  creative  commonsLicencias  creative  commons
Licencias creative commons
mariofarid
 
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
martinjgraham
 
Abstract Factory and Builder patterns
Abstract Factory and Builder patternsAbstract Factory and Builder patterns
Abstract Factory and Builder patternsEdison Lascano
 
PHP array 2
PHP array 2PHP array 2
PHP array 2
Mudasir Syed
 
Menu Quen Cafe
Menu Quen CafeMenu Quen Cafe
Menu Quen Cafetrangvth
 
Tropical rainforests
Tropical rainforestsTropical rainforests
Tropical rainforests
Shahd Eldin
 
エンジニア勉強会_DECIDE
エンジニア勉強会_DECIDEエンジニア勉強会_DECIDE
エンジニア勉強会_DECIDE
エンジニア勉強会 エスキュービズム
 

Viewers also liked (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
 

Similar to Hw7 mediator memento observer

Lecture 4 (1).pptx
Lecture 4 (1).pptxLecture 4 (1).pptx
Lecture 4 (1).pptx
SumairaRasool6
 
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
Edison Lascano
 
Hw5 proxy, chain of responsability, command
Hw5 proxy, chain of responsability, commandHw5 proxy, chain of responsability, command
Hw5 proxy, chain of responsability, command
Edison Lascano
 
MS Word
MS WordMS Word
MS Word
butest
 
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
IJECEIAES
 
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
Servicio de Difusión de la Creación Intelectual (SEDICI)
 
Intelligent agents in ontology-based applications
Intelligent agents in ontology-based applicationsIntelligent agents in ontology-based applications
Intelligent agents in ontology-based applications
infopapers
 
Cognitive Architectures - Research Circle
Cognitive Architectures - Research CircleCognitive Architectures - Research Circle
Cognitive Architectures - Research Circle
Amr Kamel Deklel
 
Rapid software evolution
Rapid software evolutionRapid software evolution
Rapid software evolution
borislav
 
Hw6 interpreter iterator GoF
Hw6 interpreter iterator GoFHw6 interpreter iterator GoF
Hw6 interpreter iterator GoF
Edison 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 systems
Bouneffouf 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.pdf
KristiLBurns
 
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
Luxembourg Institute of Science and Technology
 
Hw4 composite decorator facade flyweight
Hw4 composite decorator facade flyweightHw4 composite decorator facade flyweight
Hw4 composite decorator facade flyweight
Edison Lascano
 
CS4700-Agents_v3.pptx
CS4700-Agents_v3.pptxCS4700-Agents_v3.pptx
CS4700-Agents_v3.pptx
0137RajatThakur
 
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
eyewaregallery
 
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
IJTET Journal
 
human_factors_03.ppt
human_factors_03.ppthuman_factors_03.ppt
human_factors_03.ppt
University of Manchester
 
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
Ansh Sam
 
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
FET AWARE project - Self Awareness in Autonomic Systems
 

Similar to 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
 

More from 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 Scrum
Edison 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 Cloud
Edison Lascano
 
UML for Aspect Oriented Design
UML for Aspect Oriented DesignUML for Aspect Oriented Design
UML for Aspect Oriented Design
Edison Lascano
 
Soap and Rest
Soap and RestSoap and Rest
Soap and Rest
Edison Lascano
 
Hw12 refactoring to factory method
Hw12 refactoring to factory methodHw12 refactoring to factory method
Hw12 refactoring to factory method
Edison Lascano
 
Hw11 refactoringcreation
Hw11 refactoringcreationHw11 refactoringcreation
Hw11 refactoringcreation
Edison 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 2
Edison Lascano
 

More from 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
 

Recently uploaded

How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 

Recently uploaded (20)

How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.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.