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,130 | Comments: 45,561

filter by tags archive

MactoWarrants are for fools

time to read 2 min | 394 words

Warrants are kinda important in a prison. They are the legal authority to limit someone’s freedom. In wouldn’t be overstating the fact in saying that Warrants are one of the major factors being managed in Macto.

There are all kind of Warrants in existence. To list just a few of them:

  • Arrest Warrant – Issued by an officer, generally hold for 24 hours only.
  • Detention Warrant – Issued by the court, generally for a short amount of time, up to a few weeks, in most cases.
  • Remand Warrant – Issued by the court, generally instructing the prison to hold the Inmate in custody until sentencing (not limited in time).
  • Sentencing Warrant – Issued by the court, specifying the total time that an Inmate is to be incarcerated.

There are other warrants, such as an Court Arrest Warrant, for example, but for the purpose of Macto, we won’t get into those. The type of activity currently required by the prison doesn’t really need them, but that might change in the future.

There is also another type of Warrant available, it is Whatever The Judge Said Warrant, or as the lawyers call is Mandamus Warrant. It is basically an instruction to do something, and it can be just about anything. From letting the Inmate to call his wife to putting him in a different cell or transferring him to a different prison to command special food / treatment to… Well, there is a reason I call it Whatever The Judge Said.

The rules for Warrants for incarceration are pretty simple. Each warrant type has an issuer (Arrest Warrants can only be given by Officers of rank Captain and above) for a certain duration (which in some cases, may be limited, such as the 24 hour limit for Arrest Warrants). Depending on the type of Warrant, it can be in Hours, Days, Months or Years. The units in which a warrant is specified are very important. In particular, there is a difference between 30 days incarceration and 1 month incarceration, for example. And hourly Warrants requires that by the time the Warrant expire, you are either got a new one at court or let the Inmate go.

The last issued Warrant is always the one that is valid, and all Warrants must be continuous. Gaps in the middle are considered to be a Very Bad thing.

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

Is a new sentencing warrant issued if the inmate is released early on parole or probation?

Ayende Rahien

Paul, No, you get a Parole Warrant, or a Release Warrant.

Paul Cox

So Macto needs to be concerned with only warrants that change the length of the inmates incarceration?

Do parole and release warrants have a duration for when to release the inmate, a specific date, or do they just effectively say release the inmate today?

Do all inmates get a release warrant or are they normally just released at the end of their sentence warrant?

Ayende Rahien

Parole may be for a specific time in the future, as can be a appeal that reduced the sentence. Release warrant is usually immediate, maybe with 48 hours for counter appeal.

Inmates are automatically released at the end of the sentence.

Dmytrii Nagirniak

I wonder how many people among devs are actually following all those in-depth prison explanations :)


I am. And having all this new insight into justice system, I wanted to use it to escape speeding ticket I got yesterday.

Didn't work.


I am - nice to think about another domain once in a while and the challenges\solutions...


As I understood, macto was supposed to be enterprise solution sample or smth. And now it has such complex business requirements, wondering if anyone will have enough patience to look long enough to see any architecture through prison business logic.

Matthew Shapiro

@Giedrius: if you don't want to wait for the full series you can always go to his Github and look at his Macto code: https://github.com/ayende/Macto

Frank Quednau

@Giedrius, in my book if that happens that would be a pretty darned good architecture.


@Matthew Shapiro: well, there's not much what to see at the moment, but that is not the main issue. Main issue that domain for example is too complex and too uncommon and to understand reasoning why is made this or that in architecture you need to understand domain also. There's a reason, why blog system is common example - because domain is quite narrow and it is known to everyone. I'm not saying, that enterprise example should be blog, actually I'm sick of blog examples, because usually they are too simple for real life scenarios. I think best way for choosing theme for enterprise sample would be finding most common tasks in real life and implementing them with as simple as possible domain (but not simpler!). Most common task examples would be: - real time integration with another system - periodical integration with another system (like every 1 hour or smth.) - long running tasks (like generate report, that takes 1 hour to complete) - security model So let's say shop: there may be real time integration (payment systems), there may be periodical integration (updated shipment statuses), there's need for security model, and there's need for tools to monitor all this stuff and shop domain should be very understandable for most of developers.

Sean Gough

@Giedrius - the problem with that is you have yet another 'fake' domain. What is needed (and it seems that Ayende is heading there) is a complex, real life scenario followed by examples/insight into how you flush out the system requirements and design an architecture suited for it. Using a shop (or some other relatively simple and common scenario) will result in exactly what Ayende is trying to avoid - demonstrating patterns and architecture for architecture sake.

Developers aren't always going to land projects/jobs in domains they are familiar with, so the fact that this is unfamiliar territory to most is actually a good thing. If anyone gets bored or is unwilling to read into the background to better understand the problem then frankly they aren't suited for the task at hand. They have to be willing to understand the domain if they have a hope at designing a proper architecture for it.

Chris Wright

"And hourly Warrants requires that by the time the Warrant expire, you are either got a new one at court or let the Inmate go."

What about day- or month-based warrants? Should be the same, no?


This is a very interesting series, especially since the software I work is in this field, although it deals more with pre-prosecution police work than incarceration.

The biggest design problem for our company,which seems to have very little mention in these articles is the differences in the justice system between jurisdictions.

Perhaps the focus of this series is to show how to make a one off solution, or perhaps in Israel the justice system is more uniform than here in the States.

We sell a off the self product that currently has to work in all 50 states in the US, and are getting interest from abroad, and although almost every jurisdiction in the world is influenced by English common law, there are very large differences even between states in the US when it comes to the prosecution and incarceration system, specifically in the areas of the order of events, maximum time between events, grand juries, warrants, sentencing, privacy etc.

Our product currently has many switches to compensate, also there is a certain factor of convincing the agency we sell to that they should actually change their long standing SOP to one that actually works better from another jurisdiction, but in the end the laws are different, and a single code base that needs to adapt can be difficult to make perform well with customizability to each customer.

Are future goals are tending toward a DSL to allow us to change the complex statutory based business logic more quickly and per customer, and even allow the customer to update this business logic, because as we have found, the law is a constantly moving target, nearly every year statutes change that can affect hard coded business logic.

Ayende Rahien

Chris, Yes & No. The main different is that a daily/monthly/yearly allow to hold an inmate until midnight, while in most hourly warrants, you have until a very specific hour, and that might mean that you have to rush someone to court to make the time limit

Ayende Rahien

Justin, In Israel, there are probably 4 different law systems that I routinely had to work with. Civil Criminal Army Disciplinary Army Criminal Army Terrorist

There are other stuff that we run into more rarely. Border control, for example, which is another kettle of fish.

All of them had drastically different requirement for anything.

As you said, a DSL might be a good place to define those sort of things, or a strategy / state pattern. It is hard to explain without actual details, but one of the major problems is that you need to be able to: - Figure out when the warrant runs out. - Figure out why it runs out. - Figure out if you have the authority to hold the inmate (minor, murderer, flight risk, etc)


would you know if the israeli justice system is based mainly on a British (mandate holdover) or a European (Immigrants) model?


In the US we generally have 4 levels of overlapping jurisdictions, Federal, State, County, and City. Jails are county or city, prisons are state or federal. The judicial system is primarily state or federal. At the federal level we have many overlapping agencies with arrest power: FBI, DEA , ATF, US Marshall, Secret Service, DOJ, Military, Border patrol, many many more. 50 states each with multiple state level enforcement agencies, usually more broken up by type of offense, highway, fish and widlife, insurance fraud, etc. Over 3000 county governments with sheriffs and over 30,000 city governments many with police agencies, some contracting with county for law enforcement through the sheriff.

Laws can be defined at all 4 levels, although usually they are modeled after the larger jurisdiction, that is most state law is modeled after a equivalent federal law, and county/city laws are usually just minor ordinances.

Since we deal with Investigation/Enforcement, we have to deal with arrest,search, and intercept(communication monitoring) warrants, among others. So warrant for us has a approving judge, and issue date, expiration, and the narrative, or actual text of the powers granted. Of course we have a way to classify into types, because for instance a search warrant needs to be deconflicted on the location to make sure another agency or even another group inside a large agency isn't also serving the warrant at the same time or "bad" things can happen.

Even terminology between agencies is different,what one agency calls an indictment another calls a complaint or another a accusation, many of our customers demand the terms be changed in the system, even though they are equivalent, but the laws themselves are very specifically worded, and exacting semantics must be used in court filings to prevent problems.

So the customizability points that customers want are are field names and labels, workflow customization for the document routing/approval, screen/print layout, as some forms must be submitted to other agencies in a very specific format or they are rejected. Basically just about everything ;).

Some of the business rules are complex and convoluted, for instance in the state of Florida, since they still use summary UCR reporting for crime stats, which was developed in the 1930's, a male cannot be raped, we actually have a business rule in our report approval process that says if Florida UCR enabled and sex = male and offense = rape then throw an error preventing approval. Another is example is defining someone as a "gang member" as this can elevate a sentence in some jurisdictions. There is a federal recommendation that most states model after, but they make some changes to the "scoring" criteria, Such as "person arrested with other known gang members more than X times counts as Y points".

I could go on, this is definitely an interesting problem space.

Ayende Rahien

Peter, We started out as a British mandate law. I am not really sure what you mean with European law, but I think that a lot of our legal system still has its roots in British law.

Ayende Rahien

Justin, That is certainly an interesting problem space, yes.

What this gets down to is: - Customized rules - a perfect place for a DSL. - Customized workflow - DSL - Customized labels - you could probably handle that using i18n mechanics. - Customized fields - Custom data for each tenant, which depend on how you are actually setup and deploy.

I assume that you have different installation for each tenant? If so, it is a relatively simple process, I would guess, from a technical perspective. From a business perspective, that is different :-)


Re: "European" Since many of the early founders were modernish Polish with socialist leanings, I supposed that they would have a sort of European outlook.


Usually one installation or instance per tenant, some tenants have multiple instances, when they really want isolation that they don't believe the security model can provide. Some systems are multi-tenant, usually in the same state jurisdiction, but it does complicate matters.

For customized data, since we are pretty committed to relational, and that is pretty much what the customers will take at this point (We have to fight for MSSQL over Oracle quite a bit, let alone something more exotic) and the ad-hoc query/reporting tools just aren't there otherwise. We are tending toward a table per subclass using schema separation for customer customization. Most of our competitors are just doing key-value tables or CustomField1,CustomField2 stuff.

Ayende Rahien

Peter, The law system has a decidedly European look, sure, but that is because the UK is in Europe. I don't think that the Polish founders had a lot to do with the legal system. Now, if you want to talk about socialist tendencies, that is certainly the case.

Ayende Rahien

Justin, Separate custom data to a separate schema wise, yes. And not having to support massively mutli tenant on a single installation means that you can get away with that quite handily (if you have 1000s of tenants on the same db, you would probably go to the different db approach, instead).

Paul Hatcher


The two major law code bases in Europe are English and Napoleonic Code; primary differences are trial by jury vs investigating magistrate, and I would guess you are English law based

Ayende Rahien

Paul, Thanks for the details, yes, we are by English law, with investigating judge and not a jury

Ayende Rahien

Paul, Thanks for the details, yes, we are by English law, with investigating judge and not a jury

Comment preview

Comments have been closed on this topic.


  1. RavenDB Conference 2016–Slides - one day from now

There are posts all the way to Jun 01, 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