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,007 | Comments: 44,760

filter by tags archive

Macto, or How To Build a Prison

time to read 3 min | 506 words


The sample application that I am going to build is going to be a prison management application. I am going to take this post as a chance to talk about it a bit, discuss the domain and then I’ll talk about the overall architecture in more details.

The domain of a prison is actually fairly simple, you have an inmate, and the sole requirement is that you would keep him (it tend to be overwhelmingly him, rather than her) in lawful custody.

The term lawful custody has a lot of implications, which are, in more or less their order of importance:

  • The inmate is in custody, that is, he didn’t manage to run away.
  • Custody is lawful, that is, you have legal authorization to keep him in jail. Usually that means an order by a judge, or for the first 24 hours, by a police officer.
  • Lawful custody itself means that you:
    • keep the inmate fed
    • in reasonable conditions (sleeping quarters, sanitation, space)
    • access to medical facilities. Indeed, in most prisons the inmates get better health care, especially for emergencies, than the people living in most big cities.
    • ability to communicate with lawyers and family

The devil, however, is in the details. I am pretty sure that I could sit down and write about 250 pages of high level spec for things that are absolutely required for a system that run a prison and still not get everything right.

In practice, at least in the prisons I served at, we did stuff using paper, some VB6 apps & Access, and in one memorable occasion, an entire set of small prisons where running on what amounted to a full blown application written using Excel macros.

Anyway, what I think that I’ll do is start with a few modules in the system, not try to build a full blown system.

The modules that I‘ll start with would be:

  • Staff – Managing the prison’s staff. This is mostly for authentication & authorization for now.
  • Roster – Managing the roster of the prisoners, recording Countings, etc.
  • Legal – Managing the legal side of the prisoners, ensuring that there are authorizations for all the inmates, court dates, notifications, etc.
  • Escort – Responsible for actually taking the inmates out for court, medical evacs, releasing inmates, etc.

That is enough for now, for that matter, it is a huge workload already, but that is about the only way in which I can actually have a chance to show a big enough system and the interactions between all the parts.


Kyle Szklenski

I hope you meant a Roster class, not Rooster. :) That would be one hell of a rooster, managing all that!


A large feeling of anticipation, and a nagging one of guilt. A week or two after writing about needing to take breaks to avoid burn out you are making a complex application for no other purpose than community example. Thanks.

Bobby D

Really looking forward to seeing the app come together.. thanks for listening to the readers!

Kornelije Sajler

Sounds very interesting. I can't wait to see progress of MactoPMS and great developer at work. I also hope that you will not stop and rework all app like Rob Conery did!

Mikael Henriksson

Without doubt the most interesting sample application I have come across so far. Will be very nice to follow how you go about it.


In your post "Feature by feature" that you had multiple folders in the same project / assembly for Model, Infrastructure etc.

You also mentioned that you think really hard before creating new assemblies. While I agree excessive layering is bad, what is the difference between this approach and creating seperate assemblies for model & infrastructure.

It is more separation of concerns than needless complexity

Ayende Rahien


More projects == slower VS

Jake Scott

This should be good cant wait!

Kyle Szklenski

Also, venu, who says you can't have separation of concerns with a single assembly? I think having a decent folder structure that all developers involved understand and more importantly use can be just as effective. Just have to make sure no one crosses the line, and since there's only one developer on this right now. . .


Looking forward to this series.

Frank Quednau

Excel Macros...Hm, thank God I've never been sentenced to 77.1*850 years in prison, it would take even longer than expected!

Comment preview

Comments have been closed on this topic.


No future posts left, oh my!


  1. Speaking (3):
    23 Sep 2015 - Build Stuff 2015 (Lithuania & Ukraine), Nov 18 - 24
  2. Production postmortem (11):
    22 Sep 2015 - The case of the Unicode Poo
  3. Technical observations from my wife (2):
    15 Sep 2015 - Disk speeds
  4. Find the bug (5):
    11 Sep 2015 - The concurrent memory buster
  5. Buffer allocation strategies (3):
    09 Sep 2015 - Bad usage patterns
View all series



Main feed Feed Stats
Comments feed   Comments Feed Stats