The Fight Over Rules As Code

Author:Jason Morris
Date:June 14, 2019
In this corner, Pia Andrews

Pia Andrews is the Executive Director of Digital Government for the Department of Finance, Services and Innovation of the Government of New South Wales in Australia. She is a self-described open data and open government “ninja.”

She recently shared some work her NSW Policy Lab is doing on Rules as Code or “RaC.”

A major idea in the “Rules as Code” community is that government legislation and regulation and policy can and probably should be drafted in two languages at the same time. It should be drafted in natural human language (in Canada English, French, or both) as it is now. It should also be drafted in a machine executable language at the same time. And both would be published side-by-side.

The benefits to this co-drafting approach are more than you might expect.

Co-drafting simplifies creating automated government services, certainly. In addition to saving time and effort in writing software to answer legal questions, it also provides a single, authoritative interpretation of what the rules mean.

But perhaps surprisingly, even if you never use the encoded version, drafting them that way may makes the rules themselves better.

Certain mistakes that might be hard to see in a natural language rule become plainly obvious when you try to encode that rule. Writing in both languages forces you to be more precise about what you are saying, bringing problems to light that you wouldn’t see drafting in English. Arguably, co-drafting in a machine executable language is just better drafting technique.

But more than that, machine executable legislation can be tested in ways that human beings are not capable of. A human being cannot generate 10,000 random fact scenarios, calculate legal outcomes for those scenarios, and test those legal outcomes for unexpected results in a matter of minutes. So the legislation can be “debugged” as it is being written, instead of the loopholes being found later.

This means that not only can the rules be encoded, but so can tests. And these tests benefit from the same rigour imposed by a machine executable language.

For a more complete run-down of the thinking around Rules as Code, check out the Better Rules for Government Discovery Report from New Zealand’s Service Innovation Lab.

Andrews’ Policy Lab recently tested some of these ideas by encoding some existing legislation in a tool called OpenFisca, and then using that code to generate two different user-facing tools to assist people in finding...

To continue reading