Skip to content

Initial transitions

Leon Starr edited this page Aug 4, 2026 · 3 revisions

A born and die lifecycle is defined on a class whose instances are created and deleted during runtime.

For this type of lifecycle you need to specify one or more initial transitions between the Events block and the States sections.

In the Elevator Management domain, an instance of a Transfer class is created when a Cabin is dispatched and deleted when the transfer is complete. So its lifecycle specifies an initial transition.

initial transitions
    initial > CREATED
--

The grammar:

// Initial transitions
initial_transitions = it_header transition* block_end
it_header = "initial transitions" EOL*
transition = INDENT event_name (SP '>' SP state_name)? EOL*

The unindented initial transitions header (note: two words, one space, all lowercase) is followed by any number of indented transitions written exactly the way they're written inside a state — see Transitions for the anatomy of that line — and closed with an unindented --.

So initial > CREATED says that a Transfer instance is created by the initial event and begins life in the CREATED state.

The creation event must be declared in the Events block like any other, and it is an interaction event — it arrives from whatever asks for the instance to exist, never from the instance itself.

More than one

The grammar allows multiple initial transitions. This is useful when an instance may be created under varied circumstances. Each such transition may lead to a different initial state.

Clone this wiki locally