当你编码时你在做什么:谈编程的本质(一)状态机

本文探讨编程的本质,聚焦于状态机在理论计算和分布式系统中的重要性。作者引用Lamport的观点强调,理解概念而非语言是提升编程能力的关键,通过数学描述状态机有助于统一计算机科学的不同部分。文章还提到了状态机的数学表示,如集合、函数和逻辑,并举例说明了状态机在自动机、冯·诺依曼计算机、算法和分布式算法中的应用。

当你编码时你在做什么:谈编程的本质(一)状态机

这学期学习了两门有意思的课,Theory of Computation和Distributed System,一低一高完全两个层次上的分支,却意外地发现两者在理论方面的重叠——那就是状态机。在Theory of Computation中,DFA、NFA、Turing Machine都是非常经典的State Machine,而在Distributed System中,Global State的确定、一致性协议的Replicated State Machine等处,又再次看到了它的身影。

于是搜到了图灵奖大牛Lamport的一篇论文《Computation and State Machines》,讲述了无所不能的State Machine。下面对这篇note中触及编程本质的几处做下摘录,句句经典:


1. Think Better, Code Better

“I believe that the best way to get better programs is to teach programmers how to think better. Thinking is not the ability to manipulate language; it’s the ability to manipulate concepts. Computer science should be about concepts, not languages. But how does one teach concepts without getting distracted by the language in which those concepts are expressed? My answer is to use the same language as every other branch of science and engineering—namely, mathematics.”

“The obsession with language is a strong obstacle to any attempt at unifying different parts of computer science. When one thinks only in terms of language, linguistic differences obscure fundamental similarities. Simple ideas can become complicated when they must be expressed in a particular language.”

Lamport认为想要让程序员写出更好的代码,不是天天教他们如何使

评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值