More on Data Integrity
In response to my post on The Myth of Data Integrity, Will submitted a very interesting comment. I’ve decided to use it in order to clarify some of the confusion that my initial thoughts seem to have caused. Here is what Will had to say, on November 3, 2005:
So let’s say I define a constraint in my database that doesn’t allow you to post a transaction to a closed accounting period.
This prevents any application that uses my database from posting data that will damage the correctness of the company accounts.
Furthermore, the database logs any changes to the status of an accounting period, so no matter which application changes the status, we know who reopened the accounting period and when they did it.
Can you please explain under what circumstances you need to be so “agile” that you would want to circumvent these rules?
Firstly, I would never want to circumvent the above rules (if they are indeed valid business rules for the system under study). Striving for agility does not mean circumventing rules. It means stopping to determine which rules are absolutely necessary, and then using the least possible amount of effort to ensure that the rules will be properly applied.
I’m not sure what is it in my original post that led you to believe that I am advocating the abandonment of business rules? Granted, I was angling toward abandoning the idea of expressing the rules inside the RDBMS, but that does not automatically mean that I was insisting that the rules must be ruled out (no pun intended) for good.
Data and Behavior
Data without associated behavior is difficult to deal with. Sure, human mind is awesome in its capability to parse through the unordered sludge of textual information, fishing out subtle patterns and meanings. But the mechanical attempt at emulating the human mind falls pathetically short when it comes to doing similar parsing.
Because of that, we are forced to associate behavior with the data once it enters the information processing system. Only by doing that can we enable our mechanical system to know that an employee cannot be hired if that person happens to be only two years old, etc.
In the early days of information processing, all the behavior applicable to the data was defined and stored in a monolithic fashion (read: inside one giant cloud of COBOL code). The advancements in computing, especially in the areas of architecture and programming, led us toward favouring modular over monolithic. Thus we’ve ended up separating data from the behavior.
Traditionally, data is viewed as a pile of deadwood, sitting somewhere on the auxiliary storage at certain addressable location. Software code then gets layered on top of that data, and its purpose is to lend meaning to the otherwise illegible pile of bytes.
RDBMS is one such layer of software code that sits on top of the pile of otherwise meaningless bytes (meaningless form the machine’s point of view, of course). It is possible to bypass the RDBMS layer and go straight to the underlying flat file system, where the data actually resides. No one has ever done that, because it’s too much work for no benefit. But, it is possible.
What RDBMS is giving us is a nice abstraction layer that simplifies for us the ways to deal with the underlying flat storage of the bytes.
This is all fine and dandy, but the religious wars begin when we open the debate on where should the domain-specific behavior reside. In the RDBMS? Or in the higher level of abstraction, in the actual programming code?
Domain-specific Behavior
As we’ve seen, RDBMS specializes, out of the box, in general purpose behavior. For example, data that is tagged by the RDBMS as numeric, cannot contain alpha characters. And so on.
But when it comes to domain-specific behavior (such as ‘a customer who had already used up two promotional coupons does not qualify for any further discounts’), arguably such behavior does not belong inside the RDBMS. It is none of the RDBMS’s business.
So now we have an interesting situation where, just as RDBMS sits on top of the flat file structure and breathes certain meaning into the low-level logic of the bytes, the application code sits on top of an RDBMS and breathes more finesse, more sophisticated logic into its admittedly low-grade generic behavior.
I think everybody will agree with the above. If so, where is the problem, then?
To Centralize or to Decentralize?
The problem lies in people’s understanding of the nature of control. Sure, we all (agile as well as ponderous and slow-paced) agree that the rules must exist. But what we disagree on is how are those rules to be implemented.
There is a group of people who prefer heavy centralization. The top-down military chain of command. And then there is another group of people who prefer self-regulation. This is the so-called democratic crowd.
Based on one’s personal preferences, one will gravitate toward either heavily centralized implementation (i.e. shove all the business rules inside the good old RDBMS), or toward more decentralized implementation (let the players self-police themselves; no one is guilty until proven so).
The top-down crowd insists that everyone is a priori guilty (in that, they resemble Stalin’s reign of terror).
Finally, My Answer
With apologies for the digression, I think I’m now ready to offer my answer to Will’s question:
I think it’s not the best practice to rely on RDBMS to nurse the set of rules you’ve mentioned above. The reasons are manifold, and are well known (i.e. lack of expressiveness in RDBMS, lack of version control, no comprehensive testing and refactoring, etc.).
It is much better to set things up in such a way that a layer of agile, human-friendly code sits on top of RDBMS, in the same way that RDBMS sits on top of the underlying constellation of flat files.
Same as no one should be allowed to go directly to the underlying flat files (that is to say, whoever wants to touch the data, must go only through the RDBMS instance), no one should also be allowed to go straight to the RDBMS. This is because RDBMS is too low-level for the purposes of business development. Better to have a more comprehensive system acting as a proxy to the underlying RDBMS. That system is much more maintainable, comes with versioning, refactoring, comprehensive testing, you name it.
If the rules are enforced at this level, the subsequent maintenance would be much easier.
That’s basically what us agile folks are talking about.
April 30th, 2008 at
card credit free interest rollover interest free credit card
If aspire card credit payment free slots no download
May 1st, 2008 at
no faxing required cash advance no faxing savings account cash advance
We compare credit card annual card credit fee no
May 1st, 2008 at
backgammon game internet internet backgammon
Change sprint cell phone ringtones 1000 loan payday
May 1st, 2008 at
texas holdem hand
Perhaps business accept credit card chase credit card services
May 1st, 2008 at
citibank credit card online bank of america credit card online payment
Whom free motorola mp3 ringtones free nickelback ringtones
May 1st, 2008 at
play free baccarat
For jugar seguro paginas internet texas holdem rechner
May 1st, 2008 at
win 7 card stud
Sometimes composer free nokia ringtones quick payday loan
May 2nd, 2008 at
slotmaschine spielen
It downloadable free mp3 ringtones cell free phone ringtones sprint
May 2nd, 2008 at
texas holdem software
A para ganar a la ruleta no bank statement payday loan
May 2nd, 2008 at
free cricket kyocera ringtones
Through free cricket kyocera ringtones 100 mobile ringtones virgin
May 3rd, 2008 at
giochi keno
Complete credit card free balance transfer best payday loan
May 3rd, 2008 at
credit card deal best card consolidation credit deal
Venir poquer de 7 credit card debt consolidation company
May 3rd, 2008 at
7 card stud game
At the beggining card christian credit debt help card credit interest list low
May 3rd, 2008 at
card consolidation credit debt free loan refinance free credit card debt consolidation card consolidation credit credit debt free re
For a start mobile credit card wireless service download free ringtones for motorola v3
May 3rd, 2008 at
free payday loan
Pay alabama loan payday store small business credit card processing
May 3rd, 2008 at
citibank credit card online application
Hi kasinospiele online cash advance payday loan
May 3rd, 2008 at
online spiel automat
Perhaps card consolidate credit debt it metodos sistemas ruleta
May 3rd, 2008 at
card consolidate credit debt information
Similarly cash advance detroit jeu craps en ligne
May 4th, 2008 at
chase manhattan credit card
One of credit card counseling debt consolidation best secured credit card
May 4th, 2008 at
no fax cash advance advance cash fax no quick
Rare hour in loan one payday jeu de carte
May 4th, 2008 at
approval instant loan online payday
Evitar free downloadable mp3 ringtones canadian credit card merchant account
May 4th, 2008 at
business card credit find small
Never apostar jugar portales web texas holdem online spielen
May 4th, 2008 at
tragaperras web
Par cricket wireless ringtones free real ringtones tone
May 4th, 2008 at
online spielbank
Call play 7 card stud online download free ringtones to a nokia 5165
May 4th, 2008 at
scommesse online
She application card credit visa juegos azar web
May 4th, 2008 at
slot maschinen spielen
Of the record bad card credit credit people online craps
May 4th, 2008 at
slots gratis
Here are nextel music ringtones credit card consolidation services
May 5th, 2008 at
jugar poquer internet
Two jugar poquer internet debt reduction credit card consolidation
May 5th, 2008 at
card consolidate credit debt it
That nextel ringtones maker 2 pac ringtones
May 5th, 2008 at
jugar tragaperras web
Just as low interest payday loan ruleta portal internet
May 6th, 2008 at
100 free real music ringtones
Each music nextel real ringtones free craps
May 6th, 2008 at
accept credit card payment online accept card credit online payment
Come jugar video poquer online black jack gratis
May 6th, 2008 at
spiel online kasino
With cell cingular free phone ringtones wireless online spielkasino
May 6th, 2008 at
all payday loan in canada only
Yet juegos seguros web calgary payday loan
May 6th, 2008 at
advance cash fast loan online payday cash advance loan online
There juego interactivo portales internet free nokia polyphonic ringtones
May 6th, 2008 at
jugar dados
Call ruleta suerte online advance cash loan payday software
May 6th, 2008 at
bank card credit ge money
Find cash advance no credit check advance cash loan online
May 6th, 2008 at
new ringtones new orleans ringtones saint
A approval fast loan payday free jamster ringtones
May 7th, 2008 at
hotlink maxis caller ringtones
Furthermore download new ringtones free free britney spears ringtones
May 7th, 2008 at
payday loan canada
There fax loan no online payday payday loan store
May 7th, 2008 at
visa student credit card
Just cash advance service ace cash advance
May 7th, 2008 at
juegos interactivos portal web
Find best payday loan company slots game
May 7th, 2008 at
lawsuit cash advance advance cash lawsuit pre settlement
Dear scams on cash advance company cash advance payday loan software
May 7th, 2008 at
free ringtones maker download
It fax loan no payday required ez money payday loan
May 7th, 2008 at
loan payday software ca in loan payday software
Who advance cash day loan pay low cost payday loan
May 7th, 2008 at
online payday loan application
You cash international loan payday services atlantic city
May 7th, 2008 at
advance america payday loan
Go advance cash fast loan online payday cash loan payday till
May 7th, 2008 at
free phone ringtones sprint
For a start phone ringtones verizon wireless free phone ringtones sprint
May 7th, 2008 at
advance cash company scams on cash advance company
Here cricket free ringtones quick cash advance
May 7th, 2008 at
advance cash debt free instant
Contact same day cash advance loan advance cash loan payday software
May 7th, 2008 at
e715 free monophonic ringtones samsung samsung ringtones
Diese cricket ringtones american express air miles credit card
May 27th, 2008 at
advance cash loan online payday
Before that america bank card credit login bank card credit georgia union plus credit card account cash advance payday loan software card consolidation counseling credit debt texas
May 28th, 2008 at
credit card debt consolidation company
As shown in consolidate credit card payment circuit city credit card application overnight cash advance credit card debt consolidation company card credit number validation
May 28th, 2008 at
apply credit card bad credit
Consolidate chase manhattan credit card balance card credit introductory transfer cash till payday loan credit card debt consolidation oregon card credit number valid