Austin Computer Book Club

Best Software Writing: Starbucks & Two-Phase Commits

The March meeting of the Austin Computer Book Club is fast approaching. It’s just over a week until we meet again (on Tuesday, March 21), but there’s still time to grab an ebook copy of Best Software Writing I and read at least the most interesting-looking essays.

Here’s one taste of the writing that Joel Spolsky deemed among the best, circa 2005: Gregor Hohpe’s Starbucks Does Not Use Two-Phase Commit.

By taking advantage of an asynchronous approach Starbucks also has to deal with the same challenges that asynchrony inherently brings. Take for example, correlation. Drink orders are not necessarily completed in the order they were placed. This can happen for two reasons. First, multiple baristas may be processing orders using different equipment. Blended drinks may take longer than a drip coffee. Second, baristas may make multiple drinks in one batch to optimize processing time. As a result, Starbucks has a correlation problem. Drinks are delivered out of sequence and need to be matched up to the correct customer. Starbucks solves the problem with the same “pattern” we use in messaging architectures — they use a Correlation Identifier. In the US, most Starbucks use an explicit correlation identifier by writing your name on the cup and calling it out when the drink is complete.

That’s just one of the unique perspectives to be found in this quick read. If you’re interested in joining us to discuss more, you can find all the details in this post. See you there!

Leave a Reply

Your email address will not be published. Required fields are marked *