Originally posted by Desai Sandeep:
If I am correct, Observer Pattern is meant for sending indirect (asynchronous) messages.The Event Listener Model is based on this pattern.
No, the canonical Observer pattern works totally synchronously.
The purpose of the Observer pattern is to inverse the depency between client and server when you have an unknown number of servers:
Typically, a client depends on the servers it sends a message to:
<pre>
Client- - - ->Server
*
</pre>
When using the Observer pattern, the client no longer directly depends on the server, but the server depends on the client and an interface declared by the client:
<pre>
Client----> /ClientObserver/
^ * A
| |
|
+ - - - - - - Server
registers at
<
</pre>
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus