The Distilled Principles of Rules as Code (RaC): How to Produce Better Rules
The OECD's Observatory for Public Sector Innovation recently published an important discussion document on the creation and expression of rules in government, "Cracking the Code." Its centerpiece idea is 'rules as code' (RaC), which can be understood in two ways. First, it is an approach for improving the process of creating rules. Second, it literally proposes that governments should deliver rules in a format that can be directly consumed by software and machines — for example, as computer code.
Pim was directly involved in the widely recognized Better rules, better outcomes initiative in New Zealand that provided a key initial spark for the global discussion on RaC. Ron is a principal author of techniques and methods that helped prepare and empower the New Zealand work.
The Cracking the Code paper is fairly lengthy (100+ pages) and necessarily deep and cautious in its analysis. RaC is transformative but still emerging. Its adoption will have wide implications for people developing regulation and needing to interact with regulation. Our aim in this brief piece is to distill the Primer's core principles in order to provide an easy on-ramp to understanding and using RaC, as well as to move the discussion forward. Much remains to be explored about the potential, limitations, and implications of RaC.
Rules as Code (RaC) is a highly innovative idea that addresses how law and regulations are simultaneously produced in natural language and in working computer code. RaC has important implications not only for producing better rules (meaning clear and fit for purpose), but providing also a strong impetus for a powerful new generation of rule-based software platforms (ones better suited for real-world rules produced by governments and businesses).
RaC is a reaction to, and a projection of, the broader on-going digital revolution impacting citizens and businesses. The World Economic Forum has coined the term 'The Fourth Industrial Revolution' to describe the fundamental change in the way we live, work, and where the physical, digital, and biological worlds are merging.
Figure 1 summarizes what we see as the basic chain of reasoning for RaC. It identifies the urgency for governments to adapt to an accelerating digital world, the form of an appropriate response, the benefits that would accrue, and the conditions required for success.
Figure 1. The Chain of Reasoning Behind Rules as Code
What is RaC?
As indicated in the chain of reasoning, RaC represents a fundamental rethinking of how to give effect to a core responsibility of government — rule-making. It reshapes the interactions of the various stakeholders in the rule-making process, including drafters of laws and regulations, rule writers and analysts, and coders of software.
The essence of RaC can be distilled into six fundamental principles, or core notions, as follows:
(1) Digital Public Infrastructure. RaC makes a case for government to take responsibility for delivery of rules as computer code together with the rules expressed in natural language.
Currently, rules are already codified as part of digital services and software systems, though often not by the issuing government itself. Transparency, avoiding translation problems, and reducing duplication of effort are key objectives for RaC. It is generally accepted in many parts of the world that government should deliver public infrastructure suitable for the digital economy — e.g., for digital identity management. RaC or 'digital' legislation and regulation are similar foundational elements of a digital world and economy.
(2) Better Rules. RaC prescribes an iterative, human-centric, test-driven approach for developing rules.
RaC assumes human-consumable rules will be inherently better (more readable, more complete, more fit for purpose) if simultaneously drafted or interpreted along with a machine-consumable version. The traditional model of rules creation can cause challenges for digital service delivery. The rules can be difficult to understand or navigate, and their logic not robust. These shortcomings can make it difficult for designers and developers to build good digital services so people can easily understand their rights, obligations, and entitlements.
(3) Disambiguation. RaC prescribes clarity and precision in human-consumable rules; therefore, vocabulary coordination in the form of a concept model is essential.
Clarity and reduction of ambiguity are the focus during development of the concept model, which assists in the same regard during modeling of decision and development of rules. The iterative process of developing the models and rules in a multidisciplinary team drives clarity and precision. The ultimate test is using working code and automated test cases to clearly prove high quality. Running automated test cases will identify any remaining areas of ambiguity or lack of clarity or precision.
(4) Digital Twin. RAC prescribes a digital twin for government rules. Any rule for use by humans must also be available in a form usable by machines — one that is both readable and highly precise.
Why a digital twin of the rules? Historically, rules have been coded by siloed organizations, often ones outside government, who do their own interpretations. There is no way to ensure consistency of intent with dispersed implementations like this. For example, salary and holiday payments to employees might be digitally completed within payroll software. Payroll software, however, must comply with the rules in employment legislation. Without a digital twin there is no way to guarantee fidelity in the payroll software with the source rules from the employment legislation.
(5) Isomorphism. RAC prescribes that every machine-consumable rule should remain tightly coupled with its human-consumable counterpart throughout its lifetime so that changes can be effectively synchronized at all times.
With RAC, a machine-consumable rule isn't a translation of a rule by separate people at a different point in time but is developed in parallel and at the same time. This digital twin remains closely tied to its human-consumable counterpart so that the meaning of the two don't diverge over time.
(6) Interoperability. RaC prescribes that rules rendered for machines should be independent of software platforms.
Government rules must be democratized and easily accessible. Citizens, entrepreneurs, social innovators, software developers, and the systems they develop should be able to "consume" the rules without having to translate the rules. This means considering open-source solutions and avoiding any vendor lock-in for platforms capturing the rules and making rules publicly available. Use of open and widely-accepted standards is a critical success factor for RaC.
RaC prescribes fundamental innovation in how policy and government rules are developed and the format they are published in. It is a direct reaction to a society that becomes more digital. Though aimed at government, it has implications for any organization creating policy — which is just about every organization in the world.
The fundamental goal of RaC is to eliminate the costly and counterproductive chasm between policy development and its implementation as part of digital services — no matter whether undertaken by government itself or through intermediaries such as a citizen advice bureau, a tax agent, a shipping agent, etc.
RaC aims to make government more responsive and adaptive. If adopted wisely, RaC could result in improvements for government and other organizations in all the following respects.
- Regulatory risk reduction
- Agility and efficiency
The bottom line is a dramatically improved experience dealing with government.
Adoption of RaC enables government to be more agile in its policy making processes. It will also create opportunities for innovation in other areas, such as enforcement approaches in government or users outside government such as the FinTech and RegTech industry.
In its most basic form, RaC has already shown its potential for better rules as demonstrated by the New Zealand Better Rules Initiative, OpenFisca in France, the government of New South Wales in Australia, the School of Public Services in Canada, and the legal interoperability team of the European Commission. The benefits of the approach are clear-cut.
As an innovation, RaC is in its earliest stages. It is likely to evolve in exciting and unexpected ways. Nonetheless, the basic logic of the idea, and the case for it in the digital age, is simply compelling.
 J. Mohun and A. Roberts, "Cracking the code: Rulemaking for humans and machines," OECD Working Papers on Public Governance, No. 42, Paris: OECD Publishing (2020), https://doi.org/10.1787/3afe6ba5-en (also in French)
Organisation for Economic Cooperation and Development (OECD) Working Papers do not represent the official views of the OECD or of its member countries. The opinions expressed and arguments employed are those of the authors. Working Papers describe preliminary results or research in progress by the author(s) and are published to stimulate discussion on a broad range of issues on which the OECD works. Comments on Working Papers are welcomed, and may be sent to OECD Public Governance Directorate, OECD, 2 rue André-Pascal, 75775 Paris Cedex 16, France.
 N. Webster, Better Rules for Government Discovery Report, (2018) https://www.digital.govt.nz/dmsdocument/95-better-rules-for-government-discovery-report/html
 The authors gratefully acknowledge significant feedback from Pia Andrews and Nadia Webster in the preparation these principles. The views expressed in this discussion are strictly those of the authors.
 For an overview refer to M. Basu, "Four things you should know about rules as code," GovInsider, March 3, 2020, https://govinsider.asia/inclusive-gov/four-things-you-should-know-about-rules-as-code/
 For a quick introduction to concept models, see Ronald G. Ross, "What Is a Concept Model?" Business Rules Journal,
Vol. 15, No. 10, (Oct. 2014) URL: http://www.brcommunity.com/a2014/b779.html
For comprehensive discussion see Ronald G. Ross, Business Knowledge Blueprints: Enabling Your Data to Speak the Language of the Business 2nd ed., Business Rule Solutions (2020), 280 pp.
# # #