3

As we know , initial state is the initial state of the system before the activity begins and the final state is the final state of the system when the activity ends. But what exactly is the initial and final state in activity diagram? I mean , for example , there supposed to be a text on the these elements to illustrate what exactly the state (initial / final ) of the system should be in ?? please someone givean example to explain these elements.

4
  • This is confusing to me. An activity diagram doesn't show states. The start and end node are just there to make it easy to find where the activity begins and to indicate that the activity has terminated. They don't indicate states at all. A state diagram would show states.
    – Thomas Owens
    Oct 28, 2019 at 16:21
  • @ThomasOwens It's also confusing to me , then why they are called initial/ final state ?
    – John adams
    Oct 28, 2019 at 17:03
  • They aren't - see Christophe's answer - they are called "initial node" and "final node" in the context of an activity diagram.
    – Thomas Owens
    Oct 28, 2019 at 18:11

1 Answer 1

3

In short

The activity diagram models flows of control and flows of objects. There is no initial or final state in such diagrams. But there are

  • initial nodes that shows where the flow starts when the activity starts. There could be several, since activities allow concurrency.
  • final nodes that end the flow.

The confusion of initial/final activity nodes with initial/final states is certainly partly due to the same graphical symbols used to represent these nodes/states.

More infos

The logic of the nodes is about control tokens. When an activity starts, every initial node gets a token. These tokens follow the flow and trigger actions until the activity is ended.

This is very different from the logic of states. States represent a situation during which "some invariant conditions hold". Events cause transition to other states. The initial state is a temporary pseudostate that shows where to find the first real state.

Examples related to online purchasing/booking:

  • the activity diagram shows the sequence of actions: the initial node immediately leads to a choice between browsing or searching. The final node follows the checkout action.
  • the state diagram shows the state of a booking: it tells us what can happen depending depending on a state. Note also that the state may influence the booking object's behavior. Nothing can happen anymore once you've reach the attended state which leads to a final state.

Now to be honest the confusion between initial/final node ans state may also be related to their semantics, at least from a philosophical point of view: both types of diagram can be used to describe different aspects of the same behavior. In this case, having a token on an initial node could be seen as an initial state, and in the same way, the final state and the final node would both correspond to the end of the behavior.

7
  • Basically both are derived from Petri nets. That's why there are so many things that look alike.
    – user188153
    Oct 30, 2019 at 12:33
  • @qwerty_so Indeed, Activity diagrams derive from petri nets, but only since UML 2. The first publication of Petri nets dates back to 1973 (even if Mr Petri claims to have invented them already in his childhood in 1939). The state diagrams were invented earlier, in 1949. So archaeologically speaking wouldn’t it rather be state -> petri -> activity ?
    – Christophe
    Oct 30, 2019 at 13:32
  • I did no know that. But Petri's approach is a very general/mathematical one while state/activity are already concrete application. So from an inheritance view, Petri's nets are the father and the other ones children.
    – user188153
    Oct 30, 2019 at 15:08
  • @qwerty_so But isn’t the state diagram the representation if a finite state machine, which is itself a well defined mathematical abstraction: en.m.wikipedia.org/wiki/Finite-state_machine#Mathematical_model ? And isn’t it also a very general approach on its own, since it is the fundament of language theory and communication theory long before petri nets were made public, petri being focalised on control flow and concurrency ?
    – Christophe
    Oct 30, 2019 at 15:47
  • Finite state machines are not UML state machines, though they share part of the name. The reference you have uses Petri nets for explanation.
    – user188153
    Oct 30, 2019 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.