Open Source "UML Almighty": Executable UML, Simulation, Prototyping and more

September 30, 2010

Now UML Almighty supports SASE events framework

Filed under: Executable UML, UML, UML Simulation — umlalmighty @ 2:51 pm

Now UML Almighty supports SASE (self-addressed stamped envelope) events framework.

SASE is like Observer pattern with some differences.

In SASE a subscriber requests of a specific publisher that is should notify that subscriber by sending it  a specific message when an individual event occurs.

SASE facilitates the construiction of loosely coupled system in which the publishers of events need have no prior knowledge of the subcribers, and can have any number of subcribers.

In UML Almighty there are publishers and subscribers. Any UML object inside UML Almighty can be a publisher or a subscriber, this depend on the event configuration that we need.

Publisher

Is an UML object that publish events and it has a collection of subscribers. Each time a publisher trigger and event then all subsribers are nottified with a specific message (the events can have arguements).

Subscriber

Is an UML object that has subscribed to an event of some publisher.

Example

In the following image a Process change it’s state to [Running] state and the triggers an event [processResume:] to it’s subscribers with the argument [Date today]. All subscribers objects to this event will receive a notification of the event with the argument [Date today]. The publisher use one of the following messages to trigger events: [trigger:], [trigger:with:], [trigger:withArguments:], in this case we use [trigger:with:].

In the message [trigger:with:] the first arguments is the name of the event and the second is the argument of the event.

[self trigger: ‘eventNamewith: eventArgument].

In the following UML Script we can see how an object can subscribe to [processResume:] event. This is an example so we use a Script to show how it works, but the subscription code is always embebed in the application code.

In this case we have 1 publisher [cmmiProcess] and three subscribers [developer, projectLeader and processAdminsitrator].

The subscriber use the message [subscribeTo:eventHanlder:publisher:]  in order to subscribe to an event of a publisher.

The name of the event (in subscribeTo:eventHanlder:publisher:) must be equal to the name of [trigger:] message, see picture above.

When a publisher sends: [self trigger: ‘myUniqueEvent‘] then the subscriber must subscribe to ‘myUniqueEvent‘ using the same name.

[anObject subscribeTo: ‘myUniqueEventeventHandler: ‘processUniqueEventpublisher: anObject].

In the message [subscribeTo:eventHanlder:publisher:] the first argument is the name of the event (same as trigger: message), the second argument is the method of the subscriber that is executed when the event occurs and the last argument is the publisher object.

The events configuration can be changed while the simulation is running !

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: