0
Answer

observer pattern for a real time scenarion

Suraj Rai

Suraj Rai

10y
858
1
Hi,

I have a imaging software where we display the images.
We have different tools called as parameters in the UI.

Few of the parameters are namely:

 1. Colors
 2. Image thickness
 3. Change image informations and so on...

The color parameter is used to change the color of the image,
the image thickness parameter is used to change the thickness of the image,
the change image information tool is use to change the image information like name, date of scaned etc.


Requirement:

If user changes any of the parameter, we need to notify the user with a * in the UI saying
one of the parameter has changed.

Class Design:

I want to implement a observer design pattern using events existing in the parameter clases.

Question:

I read observer design pattern. I had seen it using without
events. And also the definition says that

It defines a one-to-many dependency between objects so that when one object changes state, all its dependents
are notified and updated automatically.

But in my case I have many object and in change of any object I have to notify one object. Its actually
not one to many but many to one relationship.

Can I use observer design pattern in this ?? Can you specify which class shoud have attach, detach and notify
and which class should have update ??

Any help would be highly appreciated.

Thanks.