Chris Wash
Jul 21 2010
Transactions, Part 2 - Writing Data Reliably
by Chris Wash
Programming With Transactional Systems
Commit and Rollback
Transactions either commit or rollback. Until a transaction is committed, it is assumed none of the work it has done is saved. Once a commit signal is issued by the application (either through an API call, or by a container), this work is actually performed by the transaction processing engine that's being used. If for some reason the commit fails due to an error scenario, or some other runtime exception occurs, we assume that the integrity of the transaction has been compromised and the transaction rolls back, removing any work done up to that point. When a rollback occurs, the transaction must be resubmitted.
Tagged: commit, Enterprise Integration, Intro To Transactions Series, JTA, rollback, Software Engineering, transactions, XA
Jul 06 2010
Transactions, Part 1
by Chris Wash
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:
- 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.
- 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;
Tagged: ACID properties, Enterprise Integration, Intro To Transactions Series, Software Engineering, transactions
Jul 30 2009
What I’d Tell Myself About Design If I Were Just Beginning
by Chris Wash
From all the time I’ve spent learning design, there are a handful of things I’d hope to remember or re-read if I were to ever get amnesia and have to start all over again. For new comers and experts alike, I’d like to share a few ideas about design worth thinking about through musings and links to other material that has helped form my opinions (some more relevant than others).
Tagged: captech, design, development, links, Meta/Blog, software, Software Engineering
Jul 24 2009
The Elements of Reusable Code
by Chris Wash
Back in April, there was an interesting article quoting Ron Jeffries et al on InfoQ looking at code reuse from an agile perspective. The conversation steered toward explaining reuse as a concern that is very expensive, looking at it from a top-down, “enterprise”-wide lens.
But is code reuse a black and white issue? My contention is there are varying degrees of reuse that are often neglected on a microscale within an even moderately-sized project. If the code you produce isn’t going to be reused, is it even going to be looked at? These are similar problems with similar solutions.
Jun 09 2009
Mocking with JMockit
by Chris Wash
Recently I stumbled onto JMockit and have been pretty impressed with the flexibility of the approach it takes.
Many mocking frameworks seem to take an elitist attitude toward testable code, not attempting to solve certain problems in favor of guiding one toward a more testable design. It appears JMockit is a response to this.
Tagged: captech, developer testing, hamcrest, Java, JMockit, junit, mock objects, testng, unit testing
Categories
Popular Tags
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.