✨ ARCANUM RUNE DIFFICULTY: Adept Behavioral

State of the Spool

Represent the lifecycle of a batch job (Submitted, Executing, Purged).

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: State
ARCANUM SCHOOL: Transmutation // Evolution
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
/* ooRexx State */
::class JobContext
::attribute state
::method init
  self~state = .SubmittedState~new()
::method advance
  self~state~nextState(self)

::class JobState abstract
::method nextState abstract

::class SubmittedState subclass JobState
::method nextState
  use arg context
  say "Transitioning from Submitted to Executing."
  context~state = .ExecutingState~new()

A job’s essence transforms from Submitted to Executing to Purged. The State pattern ensures behavior morphs accordingly to its current phase of existence.

Runic Tags: #state #lifecycle #rexx