Skip to main content

Declarative vs. Imperative

There are two main ways to tell a system what to do: imperative and declarative. Both approaches can achieve the same results, but they encourage very different ways of thinking about the work.

Imperative: telling how to do something

Imperative instructions are step-by-step directions. You explain exactly what to do, and in what order.

For example:

set character to Claire
set expression to angry
display "How could you do that?"
wait for player input

You’re giving the process, not just the goal.

Imperative instructions focus on how something happens.

Declarative: describing what you want

Declarative instructions describe the result you want, and let the system figure out the steps.

For example:

    CLAIRE <angry>
How could you do that?

Declarative instructions describe what the outcome should be. The how happens behind the scenes.

Why this matters

An imperative mindeset requires that you think through every step. Declarative systems remove that burden. You describe the outcome you want, and the system handles the details.

Just as importantly, declarative systems let you change how something works without changing the story. The narrative stays clean and readable, and the implementation can evolve independently behind the scenes.