Inherent Logics III.
Source: Dev.to
Declarative vs Imperative as Inherent Logics
There’s a design truth I keep coming back to: the form contains its own rule.
The structure itself tells you how it must be used. This isn’t opinion; it’s a consequence.
Simple examples
- A tree forces you to think in parents/children.
- A list forces you to think in order.
- A graph forces you to think in connections.
- A runtime forces you to think in actions and state.
This is not philosophy—it’s engineering. Every structure carries an inherent logic, a natural way it wants to operate. These are not mere preferences (e.g., tabs vs. spaces); they are the inherent logics of different structures.
We often say declarative code “describes what you want,” but that definition is misleading. Declarative isn’t about describing, narrating, or explaining. It is about defining a structure where the result is implicit in the data, not in the sequence of actions.
In declarative systems:
- ✅ the data carries the intent
- ✅ the renderer interprets it
- ✅ the result emerges from the structure
Example
{ type: "Button", props: { children: "OK" } }