the transaction monster

2007-10-09 @ 17:04#

in the last several weeks i've been working on the notion that transactions are evil. i used to use *lots* of database transactions. rollback was my crutch. until recently, i was all excited about the notion that the new Windows Server was going to include transacted *file* operations. this would solve a bunch of problems i have with projects that include handling image files and updating the results in a database. but, as i said, i am trying to stop that kind of thinking. [transactions are evil]

well, things are going fine for my recent project until i ran into this task:

  • add one or more users to the system
  • for each user successfully added, make them a member of one or more specified rights groups
  • for each user successfully added and made member of the rights groups, send a welcome email

yeah - workflow. multiple collections. multiple result states. all launched by a single click of a mouse.

so, that's a transaction, right? is it recoverable? do i allow partial completion? what kind of data do to return to the caller? status for each of the units of work (add-user-a, add-user-b, add-users-a-to-group-1, add-user-a-to-group2...)? status for each of the groups of work (add-user, add-to-group, send-email)?

see, i don't like this. not fun. it's a transaction. boo. [transactions are evil]