Ghassan Maslamani Blog and Portfolio

Code and Law

PoliticsTechComical

Law and Software (or code/programming) may seem like completely separate fields. However, they are deeply related. Both are human-created fields. Law organizes how people live, and programming organizes how machines behave.

So here I will go through what aspects of those two fields can be analogous to each other, and how interestingly they react with each other. I will use two main terms:

Code: Could refer to any software, algorithm, as well as the process of creating, and updating the code itself.
Law: Could refer to actual law, the constitution, governmental institution, decision-makers...etc.

The Analogy

Laws are to restrict or define the behaviour of humans while code is to control the behaviour of machines or computers.

Laws when written go over a long process of votes, on the other hand, code goes over a review process.

Laws when changed or updated use amendment or the article number to refer to the new change. Code on the other hand use versioning that can be numbered versioning e.g. major.minor.patch 1.2.3.

Laws typically go into a process before its applied so people can know about it, on other hand. Code goes over stages, i.e CI/CD, where code will be tested before being used in a production environment.

Laws are being exploited by a loophole, while on the other hand code is exploited through what is called security vulnerability. In other words, both of them can never be perfect.

Laws react slowly to changes, while code reacts very quickly. If a law has a major loophole, it might take years or forever to be fixed. While if code has vulnerability it will usually be quickly fixed. There is even a project at Google, called Project Zero where the aim is to defend against security vulnerability in less than 24 hours.

Code and Law interactions

Law is superior to code to enforce its behaviour, but it's very slow when it comes to acting/executing, on the other hand, code reacts very very quickly.

Law and code can conflict with each other, for example when a software company is illegally using software, a classic modern example is collecting personal data without user census.

Code might behave in a way that is not in general public good or interest (and when there is no legal way to stop it yet), in this case, law step in to react, it can react by creating or editing a law. Again since this process takes a long time. Until the new role is passed/applied, code could have already found a way around it!.

Add to that code could be backed by entities/companies that are very powerful, and in some instances, they are more effective than governments[1].


  1. There is a DW documentary just about that you can watch freely on youtube: https://youtu.be/Dy8ogOaKk4Y ↩︎


Contact Me

Currently Open For work. You can reach via