Ayende @ Rahien

My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:


+972 52-548-6969

, @ Q c

Posts: 6,128 | Comments: 45,550

filter by tags archive

MactoNon functional concerns, you are a legal system

time to read 2 min | 297 words

Macto is a system that operates in a highly legislative environment. As such, we have to be prepared for the court to ask us to show our records about a particular Inmate. Part of that is ensuring that we preserve the history of the Inmate’s Dossier. An example where this would be relevant is when a lawyer contend the legality of incarcerating the Inmate. You have to show not only that you have legal authority to incarcerate the guy, you also have to show that you had that authority continuously throughout the incarceration period.

A typical case where there is a problem is shown below:

  1. 27 June 2011 20:52 – Arrest by Sargent Azulay for car vandalizing.
  2. 29 June 2011 09:15 – Detention, 8 days by Judge Judy
  3. 5   July 2011 – Remanded in Custody by Judge Thachil Oti
  4. 14 Aug 2011 – Sentenced, 3 months by Judge Koev Li
  5. 27 Sep 2011 – Released at end of sentence

Do you see the problem? You probably don’t, but for me, it shouts. The issue is that an Arrest is only valid for 24 hours. Because of the gap in the incarceration warrants, a lawyer can usually get an Inmate out.

That means that part of what the system has to do is to be able to say not only what the current state, but what was the state at any given point in time. Those are usually called Temporal Systems, or Append Only systems, since you are not allowed to make modifications existing data, only create new data.

They also tend to be quite hard to work with, but this is still isn’t a post about the technical stuff, so we will let it go until we get to the good parts.

More posts in "Macto" series:

  1. (17 Aug 2011) Looking at warrants
  2. (15 Aug 2011) Talking to nasty people
  3. (11 Aug 2011) Counting is The Holy Grail
  4. (10 Aug 2011) Getting Started, you never forget your first Inmate
  5. (08 Aug 2011) The Main Screen
  6. (03 Aug 2011) Warrants are for fools
  7. (01 Aug 2011) Non functional concerns, you are a legal system
  8. (28 Jul 2011) And it goes on your permanent record, too!
  9. (27 Jul 2011) Once more from the top, I swear I had a few more over there
  10. (26 Jul 2011) Day to day life
  11. (22 Jul 2011) Where is the Inmate anyway?
  12. (19 Jul 2011) Let’s CREATE an Inmate
  13. (12 Jul 2011) Creating The Model
  14. (05 Jul 2011) The boundaries of a prison
  15. (25 Jul 2009) An end to end sample


Paul Cox

Does this mean that the user has to specify the time when something happened (e.g. The judge granted detention) rather than relying on the current time?

If so, what would the system do when the detention time was entered? Warn the user that they have exceeded the lawful period?

Ayende Rahien

Pual, Usually, no. The way it works, we need to be able to look at previous versions of the Dossier. So you can page backward in time and see all the changes.

Paul Cox

I'm still not quite clear on the legal side of the domain. For instance, when does the 24 hour period for the arrest legally begin? When they are placed in the police car, or at some specific point when they are processed at the prison?

If the system is not operational for any reason, would that be a manual process of recording the time?

Also when is the detention time determined? When they are placed before the judge or when they return to the station?

Ayende Rahien

Paul, 24 hours start from the moment the arrest is done. For practical purposes, when they put the handcuffs on you. There are manual processes, sure. The system is basically a file cabinet, nothing more. Detention is usually in days, and it is from midnight the day it was given and counting forward for how many days it is for.

Chris Sainty

I am assuming a lot of the steps in the chain have physical documents that go with them, the actual signed warrants etc. I also assume that the real documents need to be produced when needed, rather than just a print out "our computer says he should still be here". How is this sort of documentation currently managed in a paper prison, are those papers kept in the prisoners dossier or seperately? "Here is the warrant cabinet" Does macto have a role in helping manage and track those physical documents as well as their digital representations?

Ayende Rahien

Chris, Yes, lots of paperwork. The Dossier have a physical copy that is stored somewhere in the Legal dept. Ideally, we scan all those documents in and have a copy of them electronically.


I know that it isn't about technical stuff, but will event sourcing be proposed as a solution. It seems, that it's a perfect fit for it.

Comment preview

Comments have been closed on this topic.


  1. The worker pattern - about one day from now

There are posts all the way to May 30, 2016


  1. The design of RavenDB 4.0 (14):
    26 May 2016 - The client side
  2. RavenDB 3.5 whirl wind tour (14):
    25 May 2016 - Got anything to declare, ya smuggler?
  3. Tasks for the new comer (2):
    15 Apr 2016 - Quartz.NET with RavenDB
  4. Code through the looking glass (5):
    18 Mar 2016 - And a linear search to rule them
  5. Find the bug (8):
    29 Feb 2016 - When you can't rely on your own identity
View all series


Main feed Feed Stats
Comments feed   Comments Feed Stats