Welcome to the Real World

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.
随机推荐
- B5090 组题 二分答案
bzoj有毒,看不了自己哪错了...根本没法debug. 我到现在还是不知道自己代码为什么会T,二分次数也加限制了,但是还是T...救命啊!!! 题干: Description 著名出题人小Q的备忘录 ...
- 442C
贪心 感觉思路很奥妙 首先我们把那些比两边小的数删掉,因为不删的话两边的数就会选这个数,这样就成了先上升后下降的序列,很明显除了第一第二大的数都能选,然后统计就好了. #include<bits ...
- android ui篇
android ui篇主要做两件事情. 第一件事情就是能够自己去定义基本的简单的界面. 第二件事情就是能够使用开源library去构造一些复杂的界面. 第一件事情就需要对于布局等方面知识有着基本的掌握 ...
- 初学jQuery之jQuery虚假购物车-------与真实数据无关
初学者用jquery来写仿真的购物车,确实有点恶心,那我们今天就把这万恶的购物车剖析一下,来看看到底有什么难的. 购物车的效果图 那我们先从复选框开始吧,废话不多说,上代码!! 带有序号的,都是一些分 ...
- Unity引擎GUI之Text
Text 文本 要显示的字符串. Font 字体 Font Style 加粗与倾斜 Font Size 字体大小 Line Spacing 行距,文本行之间的间距 Rich Text 勾选后,想要单独 ...
- 用DIV遮罩解决checkbox勾选无效的问题
在前端开发的过程中,遇到一种情况,需要勾选,为了用户的操作便捷就将click事件放到了DIV上.(其中使用了knockout.js) 代码大概如下: <div id="one" ...
- dhtmlxtree动态加载节点数据的小随笔
最近做了一个这个东西,颇有些感触,随笔记录一下自己的过程. 首先特别感谢:https://blog.csdn.net/cfl20121314/article/details/46852591,对我的帮 ...
- 红黑联盟 php相关资讯
http://www.2cto.com/tag/phpbanben.html
- SLAM: 关于Orb_SLAM的使用小综述
0.ORB_SLAM的官方网站:http://webdiis.unizar.es/~raulmur/orbslam/ 1. 参考知乎上对 orb-slam 的评价:orb-slam在众多SLAM方法中 ...
- 【技术累积】【点】【sql】【17】了解索引
先上结论 数据库数据以平衡树进行聚合索引--主键的作用: 数据每行都存在叶子节点: 单独字段的索引,单独存在,且将该字段值取出: 单独字段的索引,查到对应的主键id,再通过聚合索引查到数据: 多字段索 ...