Lesson 3.2Lesson 3.2 · Rules as Code
The Rule-as-Code Idea
Zoom out from a single clause to the idea itself - that a regulation could be given a second, executable life, written once and run by anyone - and meet both its real promise and the deep risk hiding inside it: that to encode a rule is already to interpret it
What if a regulation had two lives - one as prose a person reads, and one as logic a computer runs - written once and reused by everyone who needs to check against it?
In the last lesson we watched a single corridor clause become structured logic. Pull back now and look at the idea that move belongs to. Today almost every rule that governs a building exists in exactly one form: prose, written for a human to read, interpret and apply. Rules as code proposes a second form of the very same rule - an explicit, machine-executable encoding - living alongside the prose. The regulation would then have two lives: the words a person reads, and the logic a computer runs against a structured model. The appeal is obvious. A rule you can run is a rule you can test, reuse and apply consistently, instead of one that every professional must read, remember and re-apply by hand.
This is a real and active movement - sometimes called rules as code, law as code, or computational law - with genuine ambition behind it: regulations that are unambiguous, testable and reusable, a single shared source that software, citizens and officials could all rely on. It is also a movement with a deep and easily missed risk, the one this whole module turns on. To give a rule a second, executable form, someone has to decide precisely what it means - and that decision is an interpretation, made once, then frozen into a tool that looks authoritative. This lesson holds the promise and the risk together, because you cannot use the idea well while believing only one of them.
One rule -> two forms: prose (read + interpret) + logic (read + RUN). Unambiguous / testable / reusable = real wins for clear rules. But someone chose the meaning: encoding IS interpretation.
The same rule, given an executable second life
The core of the rule-as-code idea is a change not in what a rule says but in what form it exists in. Today, a regulation lives as prose: sentences in the National Building Code, clauses in a municipal byelaw, provisions in an accessibility standard. Those sentences are the rule, and applying them means a human reads, interprets and compares them to a design. Rules as code adds a second form of the same rule - a structured, explicit encoding that a computer can evaluate directly. The prose still exists and, crucially, remains authoritative; the code sits beside it as an executable expression of it. Where the prose is read and remembered, the code is read and run.
This second form changes what you can do with a rule. Prose must be re-read and re-applied by every professional on every project, from memory or by looking it up, which is slow and inconsistent. An executable rule can be applied by pointing it at a structured model: the machine finds the relevant elements, tests the encoded condition, and reports the result - the same way every time. One careful encoding can then be reused across thousands of projects, by designers self-checking, by tools giving early feedback, and in principle by authorities screening submissions. The rule stops being something each person must hold in their head and becomes a shared, runnable artefact.
It helps to see this as regulation gaining a computable expression, in the same spirit that a law or a tax rule might be expressed as a formula rather than only a paragraph. For the subset of building rules that are clear and quantitative - widths, distances, slopes, setbacks, counts, areas - this is genuinely powerful: those rules already behave like formulas, and giving them a second executable form lets a design be checked against them instantly and early. But notice the quiet word doing all the work: 'expression.' The code is an expression of the rule, produced by someone who had to decide what the rule means precisely enough to run. That decision is where both the power and the danger live, and the rest of this lesson follows it.
Rules as code, law as code, computational law - and its goals
The idea of expressing rules as executable logic is broader than buildings, and it helps to know the movement it belongs to. Under names like rules as code, law as code, and computational law, governments, researchers and technologists have explored giving legislation and regulation a machine-readable, executable form - so that the same authoritative rule that people read could also drive software, be tested for contradictions, and be applied consistently. Building compliance is one domain of this larger effort; tax, benefits and regulatory reporting are others where the same instinct appears.
The stated goals are worth naming because they are genuinely attractive. First, unambiguous rules: prose tolerates vagueness, but an executable encoding forces a single, explicit meaning, which can surface hidden contradictions and gaps in the original drafting. Second, testable rules: if a rule can be run, it can be checked against examples, so you can ask 'does this design pass?' and get a definite, repeatable answer instead of a contested opinion. Third, reusable rules: encode a regulation once and every tool, designer and possibly authority can run the same logic, rather than each re-implementing their own reading. Some proponents add a fourth ambition - that rules be drafted as code and prose together from the start, so the two never drift apart.
These goals are real advantages for the right rules, and it is fair to be excited about them. But each goal carries a shadow that this course insists on naming. 'Unambiguous' means someone removed the ambiguity - by choosing an interpretation. 'Testable' means testable against the encoding, which may not match the law. 'Reusable' means one interpretation propagates everywhere, so a mistake or a slanted reading scales too. The movement's honest edge, which its best thinkers stress, is that encoding a rule is a legislative-grade act of interpretation dressed as a technical one. The goals are good; the discipline is remembering that reaching them means someone decided what the rule means, and that decision must stay visible, contestable and accountable - never hidden inside a tool that simply returns a verdict.
What the idea genuinely buys you when the rule is clear
When a rule is clear, quantitative and checkable against model data, giving it a second executable form pays off in ways worth being concrete about. The first benefit is speed: a check that would take a human minutes per clause across hundreds of drawings runs in seconds against the whole model. The second is consistency: the encoded rule applies identically every time and to every project, removing the drift where the same clause is read differently by different people on different days. The third, and often the most valuable in design, is early feedback: because the check is cheap to run, you can run it repeatedly while the design is still fluid, catching an under-width corridor or an over-long escape route when moving a wall costs nothing, instead of discovering it at submission when it costs a redesign.
There is a fourth benefit that is easy to overlook: a single, shared expression of the rule. When a regulation is encoded once, openly and well, everyone checking against it runs the same logic - designers, reviewers, and in the best case the authority - which can reduce the arbitrariness where compliance depends on who happens to examine your drawings. In the Indian context this matters: the quantitative development-control checks that dominate plan-scrutiny (setbacks, ground coverage, floor-space index, height limits) are exactly the clear rules the idea suits, and online approval systems that screen these parameters are a real, growing example of rules-as-code in practice, with genuine potential to make approvals faster and less discretionary.
Hold all of this as the honest upside. The rule-as-code idea is not hype for the checkable subset; it delivers real speed, consistency, early feedback and shared logic, and dismissing it as impossible is as wrong as over-selling it. The discipline is scope: these benefits are real precisely where the rule is clear and quantitative and the model data is good, and they evaporate - or turn harmful - when the same confident machinery is pointed at rules that are ambiguous, performance-based or interpretive. Knowing where the benefits genuinely apply is the whole skill, and it is inseparable from the risk the next section names.
The risk inside the idea: encoding is already interpretation
Now the risk that runs through the entire module, stated plainly. To give a rule a second, executable form, someone must decide exactly what it means - precisely enough that a machine can run it with no further judgement. That deciding is interpretation, and it happens once, up front, before anyone runs the tool. The prose rule may have been deliberately open, or genuinely contested, or simply vague at the edges; the encoder must nail it down anyway. Whatever they choose is then frozen into the code and applied literally, at scale, to every project the tool touches. The computer adds no interpretation of its own - it faithfully executes the interpretation already baked in.
This is why 'unambiguous' is a double-edged word. An encoded rule is unambiguous in operation - it always does the same thing - but that operational certainty can disguise an interpretive choice that was contestable, or even wrong. A confidently wrong encoding produces confidently wrong verdicts, and because it comes from a tool it can carry an unearned air of authority. The danger is sharpest exactly where the idea is weakest: when the confident machinery of rules-as-code is stretched over rules that are ambiguous, performance-based, or need facts outside the model, the encoding does not remove the judgement - it hides it, resolving a genuine question of interpretation silently, in code, where no one debates it.
The competent response is not to reject the idea but to hold it honestly. Treat every encoded rule as one reading of the regulation, made by a person, that can be right, out of date, or reasonably-but-differently interpreted from the authority's view. Insist that encodings be transparent and inspectable, so the interpretation is visible and contestable rather than buried. And keep the binding judgement of what a rule truly requires with the qualified professional, the approving authority and the actual code - because the authoritative rule is always the prose law, never its executable expression. The rule-as-code idea is powerful and worth using; it is also, at its core, a way of interpreting law, and it must be governed as one. Who does that interpreting is the question the next lessons turn to.
A second, executable form
What rules as code proposes
The same rule gains a machine-executable form alongside its prose - read-and-run, not just read-and-remember - so it can be tested, reused and applied consistently. Modules 3.1, 3.3.
Goals carry shadows
Unambiguous, testable, reusable
Each goal has an edge: unambiguous = someone chose the meaning; testable = against the encoding not the law; reusable = one interpretation scales everywhere, mistakes included. Modules 3.4, 9.1.
Encoding is interpretation
The deep risk in the idea
Giving a rule an executable form requires deciding what it means, once, up front - a legislative-grade act dressed as a technical one, frozen into an authoritative-looking tool. Modules 3.4, 8.1, 9.2.
Workshop - map the promise and the shadow of one encoded rule
The rule-as-code idea is best understood by holding its promise and its risk on the same page. In this workshop you take one rule, imagine it given a second executable form, and honestly list both what that buys and what interpretive choice it hides.
Two real rules and a notebook. No software - the aim is to reason about the idea and its risk; binding compliance and interpretation always stay with the professional, the authority and the actual code.
Goal: articulate the genuine benefits and the interpretive risk of encoding a specific rule Inputs: one real building rule (ideally a clear quantitative one and, for contrast, an ambiguous one) plus a notebook Time: ~40 minutes
- 1Choose one clear quantitative rule and one judgement-laden rule (for example a setback distance, and an 'adequate ventilation' clause). Write both out.
- 2For the clear rule, list the concrete benefits of giving it an executable form: speed, consistency, early feedback, a shared reusable encoding. Note who would run it and when.
- 3For each rule, name the interpretive choice encoding would force: what a person must decide to make it runnable, and whether that choice is small (clear rule) or large and contestable (judgement rule).
- 4Judge the fit: mark the clear rule as a good candidate and explain why; mark the judgement rule as a poor candidate and explain how encoding would hide, not remove, the judgement.
- 5Write a short reflection on why the benefits and the risk are two sides of one coin, and why the prose law and its interpretation must stay with the professional and the authority - flagged as reasoning.
You’ll walk away with
A one-page map: two rules, the concrete benefits of encoding the clear one, the interpretive choice each encoding forces, a fit judgement for both, and a reflection on holding promise and risk together - framed as reasoning, not a compliance determination.
Three altitudes on the same idea
Read the band that fits you — or all three.
Rules as code gives a regulation a second, executable life - and for your clear quantitative obligations that is a real gift, as long as you remember the code is one interpretation of the rule, not the rule. Where it fits (setbacks, coverage, FSI, height, widths, travel distances, ramp slopes) you get speed, consistency and early feedback, and you can self-check against the same logic a digitised approval system might apply. Where it does not fit - performance clauses, judgement-laden terms, anything needing facts outside the model - the same confident tooling hides the judgement rather than removing it. Use the idea for the checkable subset, prefer transparent encodings you can inspect, and treat every 'pass' as a reading of the rule against your data. You and the approving authority stay accountable; the authoritative rule is the prose byelaw and NBC, never its executable form, and binding interpretation stays with you, the authority and the law.
The rule-as-code idea reaches your work through the quantitative interior rules that can be encoded and reused - accessible-route and door widths, turning space, aisle and corridor widths, ramp slopes, exit counts - so a single shared encoding can flag issues early across many projects. That is genuinely useful: reusable, testable, consistent checks catch an under-width doorway before it becomes a rebuild. But the same 'unambiguous' encoding has quietly decided what each term means (clear opening measured how? which route is the accessible one?), and it cannot touch the judgement that makes an interior truly usable. Treat encoded checks as a fast, reusable early-warning layer on the measurable rules, ask how each rule was interpreted, and keep the human judgement real accessibility needs. Binding fire, egress and accessibility compliance stays with the qualified professionals, the authority and the governing code (NBC India, accessibility standards).
This is the conceptual heart of the course: a regulation given two forms - prose a person reads and logic a computer runs - so it can be unambiguous, testable and reusable. Learn the movement (rules as code, law as code, computational law) and its goals, and be able to name the genuine benefits when a rule is clear and quantitative: speed, consistency, early feedback, and a single shared expression of the rule. Then learn the twist that sets a thoughtful student apart: every one of those goals has a shadow. 'Unambiguous' means someone chose the meaning; 'testable' means testable against the encoding, not the law; 'reusable' means one interpretation spreads everywhere. The deep risk is that encoding is interpretation, frozen into an authoritative-looking tool. Carry both halves - the real promise and the real risk - because using the idea well means knowing exactly where its benefits apply and who decided what the encoded rule means.
“The whole point of rules as code is to make regulation objective at last. Once a rule is encoded it is unambiguous and neutral - the code just is the rule, with the human vagueness and bias stripped out - so an executable rule is more trustworthy and more 'correct' than the messy prose it came from.”
Do it yourself
No software needed - reason it through.
- 1In your own words, what does it mean to give a regulation a 'second, executable form', and how does that differ from translating it?
- 2Name the movement's three headline goals (unambiguous, testable, reusable) and the shadow each one carries.
- 3Give three genuine benefits of encoding a clear quantitative rule, with an example of each.
- 4Explain the sentence 'encoding is interpretation' and why it makes an 'unambiguous' rule potentially dangerous.
- 5Why does the deep risk get worse when rules-as-code tooling is pointed at ambiguous or performance-based rules?
The one line to carry out
Peer-reviewed journals & authoritative standards
- 01Rules as code — Wikipedia - Rules as code, 2026.
- 02Computational law — Wikipedia - Computational law, 2026.
- 03Legal informatics — Wikipedia - Legal informatics, 2026.
- 04Statutory interpretation — Wikipedia - Statutory interpretation, 2026.
If a rule is to have an executable form, the regulation itself must become something a machine can actually read - structured, defined, versioned. Next we look at what 'machine-readable regulation' really demands, and how wide the gap from ordinary prose is.
The author
Amogh N P
Architect, interior designer, and creative polymath. Studio Matrx began in his notebooks — his vision of design made honest, useful, and open to everyone. Its Academy is written and taught in his memory, and free, forever.
More about Amogh →