The Actor Model does not require state machines, but actors can be modeled as state machines.

The distinction is important.

1. Actor Model

An actor is a computational entity that, upon receiving a message, can:

    Send messages to other actors.

    Create new actors.

    Change its own behavior for subsequent messages.

Actors communicate asynchronously and maintain their own private state, if any.

2. State Machine

A state machine defines how a system transitions between states in response to events.

Formally:

(S, E) \rightarrow (S', O)

Where:

    S: Current state

    E: Event or message

    S': New state

    O: Output or effects

3. How they relate

An actor can implement a state machine:

class DocumentActor {

  state = "draft";


  receive(message) {

    switch (message.type) {

      case "PUBLISH":

        if (this.state === "draft") {

          this.state = "published";

        }

        break;


      case "ARCHIVE":

        this.state = "archived";

        break;

    }

  }

}

But an actor could also be:

    Stateless: Processes messages without maintaining state.

    Stateful without explicit states: Maintains arbitrary data structures.

    Finite-state: Transitions between a predefined set of states.

    Event-sourced: Reconstructs its state from a sequence of events.

4. The deeper connection

In the original Actor Model developed by Carl Hewitt, actors are defined by their behavior, not necessarily by a conventional state variable.

An actor’s behavior determines how it responds to the next message.

This means an actor can be understood as a potentially infinite-state transition system, even when no explicit state machine is implemented.

5. For Seed’s distributed objects

I would distinguish three concepts:

Concept

Responsibility

Distributed Object

Identity, persistent state, replication

Actor

Message processing, behavior, concurrency

State Machine

Rules governing state transitions

A distributed object could be implemented as an actor whose behavior is governed by a state machine.


The key architectural insight: An actor is a model of computation and concurrency; a state machine is a model of behavior and transitions.


They are complementary, not equivalent.


One particularly interesting question for Seed is whether every distributed object should be an actor, or whether actors should instead operate on distributed objects.


Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime