• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Fine line between controller and mediator?

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have been reading a lot of posts on the UI Controller and recently came across some on the Mediator pattern too.
I have a Controller for my UI which currently
1. handles all actions on the UI.
2. also takes care of enabling/ disabling buttons and menu items based on the selections(so each component does not need to know the behaviour of the others)

If my understanding is correct, the latter is normally done by a Mediator class.
Would I be right in saying that my Controller is also my Mediator?
Or would I need another mediator class though I fail to see the need for it. Pls shed some light on this as I am quite confused.
Venita.
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Venita,
That sounds like a Mediator to me. In the normal implementation of the Mediator Pattern, there is one class responsible for keeping all the Colleagues in synch. For this assignment I used a variation in which the Colleagues were responsible for keeping their own state in synch base on dispatched properties thru the Mediator.
Hope this helps,
Michael Morris
 
Venita Glasfurd
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Michael,
I took a look at a post where you've discussed the Component Mediator using a PropertyChangeListener and it is very impressive, but since this is a lot new to me, would like to give it some more thought before I go into it.
My question is: is it possible for a Controller to be a mediator at the same time? Or is Controller a misnomer in this case?
Venita.
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Venita,


My question is: is it possible for a Controller to be a mediator at the same time? Or is Controller a misnomer in this case?


I would say yes, it's just a matter of semantics. One would think of a Controller controlling a single object and a Mediator as controlling multiple objects, but that characterization is not always true.
Michael Morris
 
reply
    Bookmark Topic Watch Topic
  • New Topic