Imperative, Declarative, Interrogative, and Exclamatory Interfaces

Apr 12, 2023

In English, there are four different types of sentences —

  1. imperative sentences give a command (“Turn on the water.”)
  2. declarative sentences provide a statement (“The water is on.”)
  3. interrogative sentences ask a question and end with a question mark (“What temperature is the water?”)
  4. exclamative sentences express strong feelings or emotions and end with an exclamation point (“The water is too hot!”)

These ideas roughly map to the way that we interface with software. So far, only imperative and declarative systems are well-known:

  1. Imperative interfaces take commands to modify the system state — e.g., creating, starting, stopping, or deleting a server. The end user must navigate the state machine themselves.
  2. Declarative interfaces take a statement and reconcile the system until the statement is achieved — e.g., keep three replicas running at all times. The software runs a reconciliation loop that manages the state machine, doing its best to keep the system state in the desired state.

Declarative systems use imperative statements under the hood.

But where are the other two types of software interfaces, interrogative and exclamative?

What if we are on the verge of discovering the final two types of interfaces in software — interrogative and exclamative? And just like declarative/imperative are paired together, so are interrogative/exclamative. They both might operate on predicting what the desired state should be, rather than having it explicitly stated (declarative).  Here’s what they might look like:

  1. Interrogative — LLMs are interrogative machines — they are question-answering interfaces for nearly anything. Before LLMs, it was hard to imagine what it would look like to use software to ask a question over a corpus of data. This lets us query the state machine. Or think of how LLM chaining can produce declarative workflows to answer a question.
  2. Exclamative — Sometimes describing the desired state can be difficult — think of the Goldilocks principle. What’s the right temperature for porridge? Goldilocks tests each porridge and gives feedback (“too hot!”, “too cold!”) until she finds the perfect temperature. Think of how verbose some declarative configuration has become (e.g., Kubernetes). Desired state must cover every edge state transition, which can make it difficult (how many times to retry a failed job, init jobs to run before, cleanup jobs to run afterward). Instead, exclamative interfaces might be feedback machines. Converging to a desired infrastructure based on feedback.