Rollback your app?

I was driving to the doc earlier today, and a thought struck me while thinking about programming languages and medical systems. I have several friends and relatives that work “in medicine” (a doctor; an anesthetist; a dietitian; and even an ambulance driver). I was thinking about the way the language you program in has a direct link to how stable and “safe” your code is. If I code something in Java and C++, I know that the C++ code will be faster (most of the time), but I will always be less sure of it, C++ doesn’t deal with failure nearly as well as Java does (mostly because Java has a nice big VM underneath it).

So the thought was this: transactions in you language. So I can set a save-point, open and close transactions, commit and rollback bits of memory and disk, as a language feature. It would make dealing with failure a lot easier, since you could say “attempt this transaction 3 times, delay 500ms between each attempt, if they all fail, do xyz”, instead of simply “try { … } catch(…) { … } finally { … }”.

Java’s try, catch, (and most importantly) finally, is really really awesome and all, but transactions mean that if the code fails, you don’t have to worry about where it failed, so theres less or no cleanup. Anyways… just an idea 😉