I don't really see the difference between a guard and an event in state diagram , what I can see is that an event is an action that has been launched or something like that and a guard is a just a condition but I think it's more profound than that I don't know if these two terms are associated or separated, which one is necessary and which one is optional or the difference exists just between their syntaxes; an event is written without brackets, it would be great if you could help me with this.
Thanks in advance. [ Sorry if I misspelled something ]
Close. An event is simply something that has happened. Like a train arriving at the station, a light switch being turned on, or (in line with the season) Santa popping down the chimney.
Exactly. So for a state transition to fire, the event must occur AND the guard must evaluate to true. So the transition into state "leaving presents" requires both Santa to arrive (event) AND the chimney be unblocked (guard).
Essentially every transition requires an event. It does not require a guard. So the light can transition into the 'illuminated" state when the switch is turned on. No need for a guard.
Yes. The event has no brackets, the guard ( if there is one) is placed in square brackets. So
Hth.