What is Behavioral Things in UML?

The behavioral things is the dynamic part of the UML model. These are the verbs of a model. Represents actions in time and space. In general, there are two main kinds of behavioral things.

These two elements are:

  • Interactions
  • state machines

are the basic behavioral things that you may include in a UML model, typically the state machine diagram. Semantically, these elements are usually connected to various structural elements, primarily classes, collaborations, and objects.

For example: State-transition diagram of a borrower and a book in a library (Edit in the online state chart diagram editor).

Interaction

  • First, an interaction is a behavior that comprises a set of messages exchanged among a set of
    objects within a particular context to accomplish a specific purpose.
  • The behavior of a society of objects or of an individual operation may be specified with an interaction.
  • An interaction involves a number of other elements, including: messages, action sequences (the behavior invoked by a message), and links (the connection between objects).
  • Graphically, a message is rendered as a directed line, almost always including the name of its operation.

State

Second, a state machine is a behavior that specifies the sequences of states an object or an
interaction goes through during its lifetime in response to events, together with its responses to
those events. The behavior of an individual class or a collaboration of classes may be specified
with a state machine. A state machine involves a number of other elements, including states,
transitions (the flow from state to state), events (things that trigger a transition), and activities (the
response to a transition).

Graphically, a state is rendered as a rounded rectangle, usually including its name and its sub-states, if any.

Note that: A state chart diagram shows a state machine, consisting of states, transitions, events, and activities. State chart diagrams address the dynamic view of a system. They are especially important in modeling the behavior of an interface, class, or collaboration and emphasize the event-ordered behavior of an object, which is especially useful in modeling reactive systems.

Example: ATM State Chart Diagram

Now let’s look at the state transition diagram of an ATM system. Here, you’ll see what happens when a customer uses an ATM card to make a transaction:

  • When a customer inserts a bank card or credit card into the ATM’s card reader, the ATM performs an input action, which is to read the card.
  • If the card is invalid, the machine performs an exit action.
  • After the card has been successfully read, the ATM will ask for a pin number.
  • The customer then enters the password and the ATM reads it.
  • If you enter an invalid password, the machine will exit. If the pin entered is valid, the machine processes the transaction further.
  • After the transaction is successful, the machine will carry out the exit action, that is, the card pops up, the customer’s card discharged.

State Transition Diagram for ATM system

Learn More with the following State Chart Examples

Leave a Reply

Alamat email Anda tidak akan dipublikasikan.