views:

122

answers:

5

There are objects which need two other objects as parameters. This parameter objects may change during runtime.

I use another object which holds the references to the parameter objects. These references are always up to date.

All the other objects ask this objects for the current parameters. They don't have to be updated anymore. Only this "reference helper" will be updated.

What is the name of this pattern or technique, or the name of the "reference helper"?

Edit: Here is a Java example:

class ReferenceHelper {

    private Parameter parameter;

    public ReferenceHelper(Parameter parameter){setParameter(parameter);}

    public Parameter getParameter(){return parameter;}
    public void setParameter(Paramater parameter){ this.parameter = parameter;}

}

P.S. I know its almost a bean, but thats not the point, because it has a special purpose.

A: 

Maybe you are asking for the Observer Pattern (Listener).

splash
That's the pattern the objects would use if they wanted to react to changes to said parameters.
Tom
With the given example I would also vote for Aggregation.
splash
+1  A: 

I think that's just called aggregation.

Tom
+1  A: 

What you're referring to might be a Observer or in fact a more specific Data binder used for data synchronization (e.g. keeping data displayed on a View in sync with its Model).

Depending on whether your so-called parameters is just plain data or some kind of event you might be looking at a Supervising Controller (Presenter) or an Event Aggregator.

Denis 'Alpheus' Čahuk
I think it is obvious data binding technique.
Dmitry Lobanov
His code example edit was not up while I was writing this answer, will edit accordingly.
Denis 'Alpheus' Čahuk
A: 

I think you are looking for dependency injection.

EDIT: I say this because you don't want to hard code the object creation in the object that needs them. Instead you want to just request them when needed. So if you look at DI containers like StructureMap or Unity they hold all the information needed to build a dependency that another object needs.

spinon
A: 

Sounds like a Mediator.

Dan