• 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

Help with Mediator Pattern

 
Ranch Hand
Posts: 146
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi people.

I've read an article on the web about Mediator Pattern: Reducing Page Dependencies in JSF.
But, even downloading the source code and studying it, I can't see the using of Mediator pattern at this solution.

I don't want to criticize the article, but instead of this, I'd like to start a discussion about Mediator at this scenario
and understand better the use of this pattern in such context.

Could someone help me to identify the using of mediator pattern at this article?

Note: in this article, the mediator class is SelectAddressForCompanyBB and SelectAddressForPersonBB.

From my point of view, the mediator pattern may be used in situations where we have some complexity over
some classes that must collaborate with each other and we need decoupling such classes, centralizing the
instances management in a Mediator class. And reading this article I can't see this.

Thanks
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The point of the mediator is to reduce the coupling in the two use cases for which addresses are selected, which the mediators seem to do. Maybe it'd be easier to describe how you don't think it fits the pattern?
 
Adolfo Eloy
Ranch Hand
Posts: 146
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:The point of the mediator is to reduce the coupling in the two use cases for which addresses are selected, which the mediators seem to do. Maybe it'd be easier to describe how you don't think it fits the pattern?



David,

I thought, Mediator Pattern, should be a class that stays between at least 2 other classes intermediating it.
And in such article, mediator seems to prepare the environment so that the SelectAddressService do not need to know
about other classes:
SelectAddressForCompanyBB and SelectAddressForPersonBB.

I thought that it must exist a class that mediates the conversation between the 3 classes described above.

Could you help me to understand better what's going on there?

Thanks in advance.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I thought, Mediator Pattern, should be a class that stays between at least 2 other classes intermediating it.
And in such article, mediator seems to prepare the environment so that the SelectAddressService do not need to know
about other classes: SelectAddressForCompanyBB and SelectAddressForPersonBB.

It's mediating between the page and the select address functionality:

The Article wrote:In order to use “Select Address” page for both “Add Person” and “Add Company” pages it is desirable to keep it independent on the latter ones. Also if assume using another page (strategy) for selecting address it is desirable to keep “Add Person” and “Add Company” pages independent on this “Select Address” page. This is where the Mediator pattern comes up. The next diagrams show the role of the mediator object:


 
reply
    Bookmark Topic Watch Topic
  • New Topic