Sunday, May 8, 2011

Data Modeling...Immutable Data

Recently I had an email dialog with a colleague that I have a great deal of respect for. The general topic was on accessing data within a database by know/constant values. Basically we needed to retrieve data from a table with one value, and cross reference it to a second value.

Everyone is thinking, "Okay...What's the big deal? We do that every day.", and I agree. At first blush this is something software developers do all of the time. But in this specific case the lookup value was going to be persisted within XML, and at the same time the persisted value is visible to end-users. One more point. Within our system there is no place that the end-user can change the lookup value, they can only see it. We want the lookup value to be immutable because there is no way to ensure that if one of the values changes, we will remember to change the other. The end-user cannot change it, and the software application don’t change it.

So let’s get to the point.

Immutable data is information within a file, table, or program that is "unchangeable". Given my description of the system above you should agree that the value in question is immutable. Right?

Well I think there is one more rule that needs to be applied to the definition of immutable when working with software systems; The end-user cannot see it.

"How does an end-user having read-only access to a data element impact immutability?" you should ask. Directly...If end-users can see something, they will eventually ask for that thing to be changed. Right? Right. That is one of the natural laws, and if it isn't it should be.

As soon as we introduce the human factor into the equation things get a little soft. Once upon a time many of us believed that things like usernames, credit card numbers, and policy numbers where immutable from a software systems perspective. That is until a person gets re-married, or their account number has three sixes within it, or they have an unlucky number that appears in their policy number. Whatever the reason, data immutability is directly related to viability. Period. Don't fool yourself otherwise.

I have a general rule...System values can only remain system values if they are only visible to the system. At the same time, users should never be restricted from changing their username, because we as software developers have used it in a "special way".

So in summary, here is my definition of "immutable" from a software systems design perspective:
---

Definition: Immutable - im·mu·ta·ble [ih-myoo-tuh-buhl] 

- adjective
Information contained within a software system that is never changed, can never be changed, and is never visible to end-users of the system.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home