Welcome to the Real World

Gregor Hohpe

EnginEERS liKE pRECiSion, especially software engineers who live in the realm of ones and zeros. They are used to working with binary decisions, one or zero, true or false, yes or no. Everything is clear and consistent, guaranteed by foreign key constraints, atomic transactions, and checksums.

Unfortunately, the real world is not quite that binary. Customers place orders, only to cancel them a moment later. Checks bounce, letters are lost, payments delayed, and promises broken. Data entry errors are bound to happen every so often. Users prefer “shallow” user interfaces, which give them access to many functions at once without being boxed into a lengthy, one-dimensional “pro- cess,” which is easier to program and seems more “logical” to many developers. Instead of the call stack controlling the program flow, the user is in charge.

Worse yet, widely distributed systems introduce a whole new set of inconsis- tencies into the game. Services may not be reachable, change without prior notice, or do not provide transactional guarantees. When you run applica- tions on thousands of machine, failure is no longer a question of “if,” but of “when.” These systems are loosely coupled, asynchronous, concurrent, and do not adhere to traditional transaction semantics. You should have taken the blue pill!

As computer scientists’ brave new world is crumbling, what are we to do?

As is so often the case, awareness is a first important step toward a solution.



Say goodbye to the good old predictive call-stack architecture, where you get to define what happens when and in what order. Instead, be ready to respond to events at any time in any order, regaining your context as needed. Make asynchronous requests concurrently instead of calling methods one by one. Avoid complete chaos by modeling your application using event-driven pro- cess chains or state models. Reconcile errors through compensation, retry, or tentative operations.

Sounds scary and more than you bargained for? Luckily, the real world has to deal with the same issues for a long time: delayed letters, broken prom- ises, messages crossing in transit, payments posted to the wrong account—the examples are countless. Accordingly, people had to resend letters, write off bad orders, or tell you to ignore the payment reminder in case you already sent a payment. So don’t just blame the real world for your headaches, but also use it as a place to look for solutions. After all, Starbucks does not two-phase com- mit, either.1 Welcome to the real world.

Gregor Hohpe is a software architect with Google, Inc. Gregor is a widely rec- ognized thought leader on asynchronous messaging architectures and service- oriented architectures. He coauthored the seminal book Enterprise Integration Patterns (Addison-Wesley Professional) and speaks regularly at technical conferences around the world.

随机推荐

  1. poj--2031--Building a Space Station(prime)

    Building a Space Station Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 6635   Accepte ...

  2. 最小割板子题——[USACO5.4]奶牛的电信

    今天邱神给我们讲了图论,还讲了一下网络流算法.自己找了一个洛谷板子题. 题目描述 农夫约翰的奶牛们喜欢通过电邮保持联系,于是她们建立了一个奶牛电脑网络,以便互相交流.这些机器用如下的方式发送电邮:如果 ...

  3. JFreeChart之堆叠柱形图(StackedBar)

    JFreeChart之堆叠柱形图(StackedBar) JAVA JFreeChart 最近的项目使用有个功能需要使用到堆叠柱形图,看了项目以前的代码实现没有想要的结果.所以自己就先到官网下载了 D ...

  4. js软键盘

    <<!DOCTYPE html><html><head>  <title></title></head><body& ...

  5. go 条件语句if

    一.if 语句 格式 if condition { // do something } 举例 package main import "fmt" func main(){ var ...

  6. [转]line-height1.5和line-height:150%的区别

    line-height1.5和line-height:150%的区别   一.区别 区别体现在子元素继承时,如下: 父元素设置line-height:1.5会直接继承给子元素,子元素根据自己的font ...

  7. 【PostgreSQL-9.6.3】修改监听的IP和端口

    在数据目录下编辑postgresql.conf文件,我的数据目录是/usr/local/pgsql/data vi postgresql.conf 找到如下内容: ... #listen_addres ...

  8. 彻底去除Google AdMob广告

    应用中包含广告是能够理解的,但经常造成用户误点,或者广告切换时造成下载流量,就有点让人不舒服了. 以下就以Google AdMob广告为例,看怎样彻底去除他. 先分析一下Google AdMob的工作 ...

  9. 说说web缓存-强缓存、协商缓存

    网上关于WEB缓存的文章很多,今天汇总一下. 为什么要用缓存 一般针对静态资源如CSS,JS,图片等使用缓存,原因如下: 请求更快:通过将内容缓存在本地浏览器或距离最近的缓存服务器(如CDN),在不影 ...

  10. PS通道的界面颜色设置

    编辑--首选项---界面--界面---选项---(勾选)以彩色显示通道(彩色显示)或者不勾选(为黑白色显示)