File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Using a Observer Pattern in a Application . Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Using a Observer Pattern in a Application ." Watch "Using a Observer Pattern in a Application ." New topic
Author

Using a Observer Pattern in a Application .

PavanPL KalyanK
Ranch Hand

Joined: Feb 28, 2009
Posts: 212
"Simply, the Observer pattern allows one object (the observer) to watch another (the subject)."

Can anybody please in what cases we need to Observe an Object ?

My question is what is the need to use an Observer Pattern?

Thanks in advance.
Saifuddin Merchant
Ranch Hand

Joined: Feb 08, 2009
Posts: 597

Typically the Observer pattern would be used in a Publisher-Subscriber situation. The observer pattern allows you to reduce coupling between the subscriber and publisher by reducing the knowledge each class must have about the other.
The publisher (subject) exposes a method by which subscribers (object) can register/de-register with it. This allows the publisher to maintain a list of subscribers without actually knowing their implementation - This is just a gist...

You can read more here.


Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
PavanPL KalyanK
Ranch Hand

Joined: Feb 28, 2009
Posts: 212
Thanks sam , it was a good answer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using a Observer Pattern in a Application .
 
Similar Threads
help on event listener
refresh modal dialog box
Observer Pattern
How to keep clients up-to-date?
Monitor all sessions in server - my solution - your opinion