Re: sequence diagram for observer pattern
- From: "H. S. Lahman" <h.lahman@xxxxxxxxxxx>
- Date: Tue, 30 May 2006 20:58:17 GMT
Responding to Chandra.somesh...
Actually the intent of representing the behavior of observer pattern
using sequence diagram was to mine instances of Design
Patterns(observer in this case) from some legacy code...the constraint
that i put on the behavior is that once the state of Subject
changes..then all its Observers are informed of this change..and each
Observer is sent the update message only ONCE for a single change of
state in the subject...To achieve this i can wrap each update message
inside an "alt" structure and further put this entire structure inside
a "loop" block.....this scheme basically takes care of the order
independence problem...however with the above schema we can have
observers being send zero or more update messages.
I would like to know if this is a valid constarint to put on the
behaviour of observer pattern or we can have an observer receiving more
than one update message per state change of subject?
As a practical matter I think the number of notifications a given Observer gets per source state change depends upon the source, not the Observer pattern. That is, conceptually we have:
(1) source state changes.
(2) source generates message to announce state change.
(3) announcement message triggers broadcast notification to every Observer (usually echoing (2)).
That is, (1) and (2) are something the source does while (3) is something the Observer pattern handles. I would expect an implied constraint on the Observer pattern execution semantics that each Observer should receive exactly one notification per announcement message generated by the source.
However, if the source chooses to generate multiple announcement messages per state change, that is a source issue rather than an Observer pattern issue. (Though obviously that could get murky in practical implementations of the Observer pattern.)
*************
There is nothing wrong with me that could
not be cured by a capful of Drano.
H. S. Lahman
hsl@xxxxxxxxxxxxxxxxx
Pathfinder Solutions -- Put MDA to Work
http://www.pathfindermda.com
blog: http://pathfinderpeople.blogs.com/hslahman
Pathfinder is hiring: http://www.pathfindermda.com/about_us/careers_pos3.php.
(888)OOA-PATH
.
- References:
- sequence diagram for observer pattern
- From: chandra . somesh
- Re: sequence diagram for observer pattern
- From: H. S. Lahman
- Re: sequence diagram for observer pattern
- From: chandra.somesh@xxxxxxxxx
- sequence diagram for observer pattern
- Prev by Date: Re: The wisdom of the object mentors (Was: Searching OO Associations with RDBMS Persistence Models)
- Next by Date: Re: Instance Methods vs. static methods in serialization
- Previous by thread: Re: sequence diagram for observer pattern
- Next by thread: Re: sequence diagram for observer pattern
- Index(es):
Relevant Pages
|