Erlang程序设计(第2版)

[瑞典] Joe Armstrong

出版时间

2014-05-31

ISBN

9787115354570

评分

★★★★★

标签

编程

书籍介绍
这不是一本讲语法的书,而是一本讲“如何思考”的书。它最核心的主张是:现实世界本就是并行的,因此程序也该天生具备并发结构——而Erlang把并发直接写进了语言本身,而非交给操作系统。全书围绕“进程”这一概念展开:每个进程拥有独立记忆、互不共享内存、仅靠消息通信协作,且创建销毁极快,甚至可以大量存在。作者Armstrong以近乎聊天的口吻,带你从Shell里的Hello World走到文件服务器、错误处理与容错系统设计,逐步理解“让错误发生、再检测并修复”的哲学。它适合愿意接受“变量不可变”“函数式禁止副作用”这些反直觉观念、想真正搞懂并发而非套用库的读者;若你只想要一本OTP实战手册,它或许会显得“泛”。
作者简介
作者简介: Joe Armstrong Erlang最初的设计者和实现者,也是Erlang OTP系统项目的首席架构师。他拥有瑞典皇家理工学院博士学位,是容错系统开发领域的世界级专家。现就职于爱立信公司。 译者简介: 牛化成 2004年毕业于浙江工商大学广告学专业,文学学士。2000年开始制作网站,对各种Web前后端技术多有深入了解。习惯思考,热爱新知,出于个人兴趣一直关注互联网各种前沿领域,并长期追踪传播学、心理学、神经科学和视觉设计等方面的最新成果。自由职业者,目前正在设计开发一个面向未来的新型网站。
AI导读
核心看点
  • Erlang之父亲笔,权威解读并发与分布式编程核心思想
  • 深入讲解OTP、ETS及多核加速,兼顾顺序与并发编程
  • 第二版全新改写,新增初学者内容与习题,紧跟语言变化
读者共识
  • 作为Erlang入门首选经典,是理解该语言精髓的必读之作
  • 作者行文如聊天般自然,但部分章节较深,适合跳读学习
  • 语法独特且并发思想深刻,需多次阅读并动手练习才能掌握
精彩摘录
  • "The world is parallel. If we want to write programs that behave as other objects behave in the real world, then these programs will have a concurrent structure. Use a language that was designed for writing concurrent applications, and development becomes a lot easier. Erlang programs model how we th"
  • "Functional programming forbids code with side effects. Side effects and concurrency don’t mix. You can have sequential code with side effects, or you can have code and concurrency that is free from side effects.You have to choose. There is no middle way."
  • "Erlang is a language where concurrency belongs to the programming language and not the operating system."
  • "A guard sequence is either a single guard or a series of guards, separated by semicolons (;). The guard sequence G1; G2; ...; Gn is true if at least one of the guards—G1, G2, ...—evaluates to true. A guard is a series of guard expressions, separated by commas (,). The guard GuardExpr1, GuardExpr2, ."
  • "1. When we enter a receive statement, we start a timer (but only if an after section is present in the expression). 2. Take the first message in the mailbox and try to match it against Pattern1, Pattern2, and so on. If the match succeeds, the message is removed from the mailbox, and the expressions "
  • "Download edemo2.erl 1> edemo2:start(false, abc). Process c received {'EXIT',<0.81.0>,abc} Process a received {'EXIT',<0.81.0>,abc} process b (<0.81.0>) is dead process c (<0.82.0>) is alive ok 2> edemo2:start(false, normal). process b (<0.85.0>) is alive process c (<0.86.0>) is alive ok 3> edemo2:st"
  • "Note: When you read this code, you’ll see we just used a variable Pid everywhere. This is the process identifier of the linked process. We can’t use a variable name like LinkedPid to say this, because before we have evaluated link(Pid), it’s not a linked process. When you see a message like {’EXIT’,"
  • "Step 1: Start an Erlang node on doris: doris $ erl -name gandalf -setcookie abc ([email protected]) 1> kvs:start(). true Step 2: Start an Erlang node on george, and send some commands to gandalf: george $ erl -name bilbo -setcookie abc ([email protected]) 1> rpc:call(ganda"
目录
第一部分 为何用Erlang
第1章 什么是并发  2
1.1  给并发建模  2
1.1.1  开始模拟  3
1.1.2  发送消息  4

显示全部
用户评论
FP果然泪目,还得读几遍....列表推导和模式匹配不能更好用!
Erlang的语法实在太怪了,感觉要看不下了,又有一本书要烂尾了⊙﹏⊙
是也乎 ╮(╯▽╰)╭ erl 创始人写的书…时隔多年良心升级了 --&gt; 对比 guido 老爹~一本也没写啊啊啊啊啊啊啊啊 --&gt; 和第一版一样~相似的结构和风格 --&gt; 更象聊天儿~而不是编程语言教程~ 没有隔壁专讲 OTP 设计思想的书好味… 初学者建议直接看最后一章… 在一个可运行有功能的运动中代码上学习是最好的了~
基础get, 还要练习
看完 Coders at work的访谈第二天来标记. 作者刚刚去世,祝安息
代入了一种完全不同的世界观 看Erlang杂技一样地处理并发 会讲故事的人不多 能讲出一个自洽世界的人更少 如果这个人还懂幽默 就很难让人不喜欢
https://github.com/liu-jianhao/ProgrammingErlang 源代码和课后习题答案
个人认为精髓在于并发的思想:每个进程都有自己独立的记忆,通过相互沟通来改变记忆,进行协作。
@2020-01-18 15:47:44
第一遍觉得很难,主要是OTP和函数式编程不熟悉。熟悉之后这本书可以当做简易小册子来查漏补缺。
下载
收藏