aspose file tools
The moose likes OO, Patterns, UML and Refactoring and the fly likes Is it neccessary to have Mediator Singleton Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Reply Bookmark "Is it neccessary to have Mediator Singleton" Watch "Is it neccessary to have Mediator Singleton" New topic
Author

Is it neccessary to have Mediator Singleton

Priyakant Charokar
Ranch Hand

Joined: May 08, 2004
Posts: 57

Hi all,
I would like to know "Is it the case that Mediator should be singleton??"


Thanks in Advance,


SCJP, SCWCD, SCMAD, SCEA, OCPJP 7, CSM
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6913
Not at all.

A mediator is just a way of decoupling the objects in a group or collection from the the objects which manipulate them. It's quite feasible for an application to contain many mediator classes, and each class to be instantiated many times.

In the "Gang of Four" book ("Design Paterns", Gamma et al.) Mediator is discussed in the context of a dialog for selecting fonts. There is no reason for this or any other mediator to be a Singleton.

Why do you ask? Have you found a situation where you think a Mediator should be a Singleton?


A Convergent Visionary ~ Frank's Punchbarrel Blog ~ LinkedIn profile
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Is it neccessary to have Mediator Singleton
 
Similar Threads
Design Pattern and its Java Implementation Question
are those parttern enough
Pattern Puzzle!!!
Creating a utility managed bean, to move common code and use from different beans?
Linda: Top 10 patterns?