ACID properties

Jul 06 2010

Transactions, Part 1

Preface

This work came out of an lack of consistent, cohesive documentation for beginners on transactions. Similar material does exist, but much of it suffers from either being hard to find, scattered and spotty, or not written at a basic enough level where requisite knowledge is not required in order to understand the material covered. Over the course of this series of articles, we'll talk about what concepts you need to know in order to effectively and correctly make use of transactions in your applications. This series of articles is written as a set of core concepts to understanding the basics of transactions, and is intended for junior to intermediate level developers, but my hope is that others will benefit from this series as well. As always, feedback is greatly appreciated.

What is a transaction?

Etymology

The word transaction comes from the Latin word transactionem meaning "an agreement, accomplishment," which itself comes from the past participle of the verb transigere, transactus, meaning "drove or carried through."

Transactions defined

The word's definition is typically related to business or economics, meaning a single business deal, or an exchange of goods between two parties. Most introductions to transactions use an example of debiting one bank account and crediting another. When we remove funds from one account, we need to make sure that they are deposited into the other. If something fails (sufficient funds do not exist in the account being debited, or the account being credited has been closed) then both accounts need to be returned to their original state before the exchange began. This is actually a very good example, but how does that apply to software?

Let's back up for a second. If we focus on what's going on, we begin to see there are two distinct activities in play:

  1. Grouping a set of multiple changes together that all have been applied successfully, or, in the event of a single failure, that all need to be undone.
  2. Managing (or coordinating) the execution of these changes, when their interactions might interfere with one another.

Examples of Transactional Systems

Like many other terms in the software lexicon such as "class", "object", "system" and "code", the definition of the word "transaction" suffers a bit from the word's inherent over-abstraction;

Read More

 

Disclaimer

The words and opinions expressed here are those of each article's respective author, and do not necessarily represent the views of CapTech Ventures.