Tag: CapTech
Transactions, Part 1
by Chris Wash on Jul.08, 2010, under Software Engineering
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 prerequisite 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?
Eliminate Branching (IF Statements) to Produce Better Code
by Chris Wash on Jan.07, 2010, under Developer Testing, Software Engineering
In a recent tech talk, I watched Miško Hevery propose an interesting challenge to his audience: start a toy project and try to write the code with no if-else or switch blocks at all. None at all? Before thinking about how to do this, why would you want to do it in the first place? On the surface, it may seem to the unassuming a bit counter-intuitive. Comparison-based branching is at the heart of programming, and the concept of an if-else or switch block is almost universal, existing in most every programming language ever devised. What’s Hevery’s agenda with this exercise – and what can possibly be gained from trying to write a program without branching entirely?
What I’d Tell Myself About Design If I Were Just Beginning
by Chris Wash on Jul.29, 2009, under Meta/Blog, Software Engineering
The Elements of Reusable Code
by Chris Wash on Jul.24, 2009, under Software Engineering
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. (continue reading…)
Mocking with JMockit
by Chris Wash on Jun.09, 2009, under Developer Testing, Java
Update: I cleaned up the example based on Rogerio’s comments.
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. (continue reading…)
What is Hamcrest?
by Chris Wash on Jun.03, 2009, under Developer Testing, Java, Software Engineering
As of JUnit 4.4, if you happen to peek into the distributed JAR you’ll notice something a little off: in addition to the org.junit.* packages there is this a funny-looking org.hamcrest.* package sticking out like a sore thumb. You may have seen other projects pick up a dependency on Hamcrest lately as well, and I bet you’re wondering what it is. Let’s get to the bottom of it. (continue reading…)
OSGi-ggity-Giggity
by Chris Wash on Apr.15, 2009, under Java, Software Engineering
Update: A great article on OSGi popped up on Javalobby today. Check it out.
I haven’t yet written any thoughts about OSGi but it’s something that’s increasingly found its way on to my radar over the past year and a half or so. I’ve been doing a little bit of reading and research on it lately, (a quick introduction can be found via Adrian Colyer’s talks on InfoQ about it). Needless to say it’s got me excited. Really excited – to the point where I’m catching myself geeking out uncontrollably like Quagmire from Family Guy. What’s got me all giggity? (continue reading…)
Java 6 and Maven 2.0.9 on Leopard
by Chris Wash on Nov.19, 2008, under Java
Trying to run through a screencast I’m putting together after upgrading to Leopard, I noticed Maven giving me a strange error when trying to run archetype:generate and realized that Leopard includes its own version of Maven (and Ant) out of the box. The problem is that it’s version 2.0.6, which doesn’t have support for this feature. I then set about trying to upgrade Maven (and in the process, Java) and here is what I uncovered. (continue reading…)
