Type Here to Get Search Results !

Events and Signals

Introduction to the Events and Signals
  • The different things that happen are called events 
  • Many events occur at the same time and at unexpected times 
  • Events represent important occurrences that have a time (the time when the event happened) and space (where the event happened) 
  • Events are used to model stimulus that can make a state machine to change its state 
  • Events can be of two types -synchronous or asynchronous 
  • In a synchronous event the sender waits for an action from the receiver on the event. For example, pressing a button on the mouse, a phone call, etc. 
  • There is no waiting in an asynchronous event. For example, sending an e-mail, letter, delivery of newspaper, etc.
Events
The kinds of events are
  • Signals
  • Calls
  • The passing of time
  • A change in state

Signals
  • Signals refer to the objects that are dispatched asynchronously by one object and then received by another 
  • Exceptions and e-mails are an example of internal signals 
  • They may have instances, generalization relationships, attributes and operations 
  • Attributes of a signal serve as its parameters
  • It may be sent as the action of a state transition in a state machine or the sending of a message in an interaction   
  • Signals are modeled as stereotyped classes and the relationship between an operation and the events by using a dependency relationship, stereotyped as send

Call Events 
  • A call is a synchronous event representing the dispatch of an operation Example: Method calls in programming 
  • It may trigger a state transition in a state machine or it may invoke a method on the target object

Time and Change Events 
  • Time Event represents the passage of time
  • Modeled by using the keyword 'after' followed by some expression that evaluates to a period of time which can be simple or complex 
  • Change event represents a change in state or the satisfaction of some condition 
  • Modeled by using the keyword 'when' followed by some boolean expression

Sending and Receiving Events 
For Synchronous Events: 
  • Sending or receiving is similar to call event 
  • The sender and the receiver are in a meeting (the sender sends the signal and wait for a response from the receiver) for the duration of the operation 
  • When an object calls an operation, the sender sends the operation and then waits for the receiver
For Asynchronous Events: 
  • Sending or receiving is similar to signal event 
  • The sender and receiver do not meet, i.e., the sender sends the signal but does not wait for a response from the receiver 
  • When an object sends a signal, the sender sends the signal and then continues along its flow of control, without waiting for any return from the receiver 


Tags

Top Post Ad

Below Post Ad