Sunday, June 21, 2009

COMMIT

Were you ever been forced to read something in school that, only after a period of time - having forgotten all about it, and on the 3rd glass of wine, you recalled- made sense? I was forced to read Freud in school, and (if you take a superficial glance at his ideas) he seems easy enough to dismiss. The insight I took away from Freud was this:

people are neither motivated nor governed by reason

Great. Given the leaking sack of fear, hope, un-fulfillment and the precious things we all carry around, it's easy to understand this insight. It is in this context that I hope to understand why several of my team-mates are not using transactions when performing multiple INSERTs, UPDATEs and DELETEs.

The utility of transactions is easy enough to prove, do a set of INSERTs, say, followed by an UPDATE referencing a column that doesn't exist. You've now fucked your database. I've actually run this experiment for junior developers at a few jobs; the response is always a variation of "it (meaning the DBMS) doesn't handle that for you?".

What's interesting is that, even after proving multiple SQL statements that modify data ought to be wrapped in a transaction, a few of my team-mates continue to piss in their code, firing off batches of these commands without a single transaction. Why? I've no answer. I've honestly never called on these folks socially and am not able to confirm the messy rooms and dirty dishes one might expect to find in the dwellings of people unable to COMMIT or ROLLBACK.

Please understand, I like the fact that these people are running around, it makes the world more interesting and they've something to offer. I just don't want these people on my team if they're allowed to INSERT, UPDATE, or DELETE.

In Protagoras (something else I was forced to read) Socrates asks Protagoras if he agrees with the rest of the world which thinks that one can have knowledge:
and yet that the knowledge which is in him may be overmastered by anger, or pleasure, or pain, or love, or perhaps by fear,-just as if knowledge were a slave, and might be dragged about anyhow.

I think I agree with the rest of the world too. If you have doubts, I've got some source-code to show you.

0 comments: