O'Reilly logo

Agile Database Techniques: Effective Strategies for the Agile Software Developer by Scott Ambler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 17. Implementing Concurrency Control

There is no I in agile. ;-)

Assume that you and I both read the same row from the Customer table, we both change the data, and then we both try to write our new versions to the database. Whose changes should be saved? Yours? Mine? Neither? A combination? Similarly, if we both work with the same Customer object stored in a shared object cache and try to make changes to it, what should happen? Concurrency control deals with the issues involved with allowing multiple people simultaneous access to shared entities, be they objects, data records, or some other representation. To understand how to implement concurrency control within your system you must start by understanding the basics of collisions — you can either avoid them or detect and resolve them. The next step is to understand transactions, which are collections of actions that potentially modify one or more entities. Examples of transactions include the transfer of funds between two bank accounts, the updating of all employee salaries to give them a 5 percent cost of living adjustment, and the updating of a customer's home phone number. In the case of the transfer, the transaction consists of debiting the source account, crediting the target account, and recording the fact that this occurred.

As you can see, modern software-development projects demand that concurrency control and transactions be not simply the domain of databases, but rather be issues that are potentially pertinent ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required