Monday, April 20, 2009

Cash Transactions : Care Continuity

In programming major applications such as finance there is a need to ensure within the transactions and the database operations that mistakes do not occur.

The classic example is a transfer between two accounts:
def transfer(from, to, amount)
from.debit(amount)
to.credit(amount)
end
It is vital that the above method (example provided by Tate and Hibbs) does not fail after the debit. In Rails the transaction method help to prevent 'digital accidents' as follows:
def transfer(from, to, amount)
Account.transaction do
from.debit(amount)
to.credit(amount)
end
end
transaction is itself a method built into Rail's Active Record that helps to maintain the integrity of transactions. Which brings me to 'care'. ...

There are several blog posts here since you reach a stage in your career when the hard fought lessons of yesteryear have to be faced again but this time like after dinner wind.
There are many possible care transactions that arise.

Many have a specific context and frequently these are conjoined:
  • timing
  • relationships - trust
  • responsibility - transfer
  • care environment
  • record (paper, electronic)
As to care transaction consider these:
def transfer(from, to, care_plan)
Care.transaction do
from.hospital(care_plan)
to.community(care_plan)
end
end

def transfer(from, to, day_care)
Care.transaction do
from.home(day_care)
to.day_center(day_care)
end
end
Wherever, whenever, whatever and whoever your transactions involve, take care of them and remember in health and social care (esp.) outcomes add up.

Don't forget to look after the however: the information, the knowledge, the promises ....
def transfer(from, to, promise_plan_of_action)
Care.transaction do
from.nurse(promise_plan_of_action)
to.carer(promise_plan_of_action)
end
end
Reference: Bruce Tate, Curt Hibbs (2006) Ruby on Rails: Up and Running, O'Reilly, p.35.