Observer Design Pattern Extension

D

decrypted

Since I couldn't find a OO design/architext forum, I thought I would post
here...

I have a win app with forms management. forms are grouped by category
(pertains to company, pertains to project. etc). This is represented, for
example, by a company window containing additional windows such as company
information, document history, yada yada. I am using the Observer/Observable
pattern to refresh all the forms in a group when another form is updated.
However, this is inefficient because most of the time, only a couple, or
somtimes no other forms need to refresh thier data. I thought about
refreshing each time the user moves between forms, but this is inefficient
because in most cases there is no need to refresh the data.

So the question is, does anyone know of a pattern that extends or uses the
Observer/Observable pattern to 'update' the Observer if and only if it needs
to be updated? I'm too damn lazy to write it myself and then go and write
the article on it, but I will if I have too =P

Thanks in advance
-dec
 
J

Jonathan

In your Observer, when it receive an update, it should determine itself
whether it need to be refreshed. If not, the observer just ignore it or
keep a state internally that allow it to update later when neccessary.

Also, you can use Subscribe/Publish pattern. The Observer subscribe to
the publisher that it interested in. So, only a subset of and relavant
forms get notified of the update.
 
A

Andreas =?ISO-8859-1?Q?M=FCller?=

decrypted said:
Since I couldn't find a OO design/architext forum, I thought I would
post here...

I have a win app with forms management. forms are grouped by category
(pertains to company, pertains to project. etc). This is
represented, for example, by a company window containing additional
windows such as company information, document history, yada yada. I
am using the Observer/Observable pattern to refresh all the forms in
a group when another form is updated. However, this is inefficient
because most of the time, only a couple, or somtimes no other forms
need to refresh thier data. I thought about refreshing each time the
user moves between forms, but this is inefficient because in most
cases there is no need to refresh the data.

So the question is, does anyone know of a pattern that extends or
uses the Observer/Observable pattern to 'update' the Observer if and
only if it needs to be updated? I'm too damn lazy to write it myself
and then go and write the article on it, but I will if I have too =P

Thanks in advance
-dec

Hi,

there is a good OO newsgroup: comp.object. It should be available from
any good news server, e.g. http://news.individual.net/.
HTH,
Andy
 
D

decrypted

no no no...the refreshing of a window is depended on the changes that
occured in some other window. So coupling would be insainly high if the
object knew WHEN to refresh itself. It knows how to refresh itself and what
to refresh, but does not know when it should refresh due to the dedency on
another form.

I'll write the pattern and publish this weekend
-dec
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top