编程世界里持续时间最长的分裂之一,就是静态类型 vs 动态类型。在我整个职业生涯中,我听过来自双方的无数论战,但真正被说服的人却寥寥无几。因为在“信仰之争”中,披着理性外衣的合理化解释,很少真的改变任何人。骑手永远会为大象选择的道路辩护。 这并不是说没有人“改宗”。恰恰相反,这些人往往喊得最响,给出的合理化理由也最激烈。那种热情,就像一个终生的杂食者突然改吃纯素,或者一个传统银行家因为踩中一波加密行情而激情布道一样。信仰越短,火焰越旺。 就我个人而言,我毫不掩饰自己是动态类型阵营的人。这也是为什么我如此热爱 Ruby。它充分利用了动态类型的优势,成就了那种诗意的语法,写出来的代码就是漂亮。在我看来,给 Ruby 加上显式的静态类型,就像给一份沙拉挖一勺冰淇淋——它们根本不搭。 我也承认,过去我曾经站在“动态类型福音派”的位置上,甚至患上了“唯一正确命题综合征”。把别人对动态类型的冷淡,视为教育不足、经验不足,甚至能力不足的体现。 多么愚蠢啊。 这就像试图说服一个内向者:只要你放开一点,其实你会喜欢聚会的。真的,在拥挤的房间里一待就是好几个小时,为了交流而大声喊叫,多有意思啊!看看这氛围(VIBE)! 这些年,我逐渐学会欣赏多样性的壮丽。如果所有程序员都被限制在同一种范式里,编程将会是一件多么可怕的事情。人类的天性如此多样,根本无法接受对创造力施加这样的束缚。 你能想象吗?如果所有视觉艺术都必须用立体主义来表现?或者只能写写实主义?或者所有小说都必须采用海明威那种简短、直接的风格?那将会多么迅速地让人厌倦! 那会彻底毁掉编程的魔力——这种艺术与工程的独特融合。 不过,我花了很长时间才得出这些结论。我是一个“康复中的解决方案至上主义者”。所以,当我看到有人捂着胸口、满脸不可思议地问:怎么可能会有人在任何地方更喜欢 JavaScript 而不是 TypeScript?我会会心一笑,想起曾经在镜子里看到的那份狂热。 这并不是说,所有编程方法的分歧都只是“不同但平等的心态”。相对主义当然有边界。但动态 vs 静态类型显然就在这个边界之内;函数式 vs 面向对象也是如此。过去几十年里,这两个轴线两端都孕育出了极其优秀的软件(当然,也产生过糟糕透顶的东西)。 如今,人们被赋予了一种祝福:无论站在哪一端,都能同样出色地表达自己。但这种“左右开弓”的能力似乎相当罕见——否则也不会经常看到双方对“对方的立场竟然也可能合理”表现出如此强烈的震惊。 我并不是左右开弓的人。我不喜欢静态类型,对象模型能点燃我的想象力。但我已经学会欣赏这样一个事实:其他人也能用同样的热情点亮自己的创造力——通过函数式编程的约束,以及清清楚楚写明的类型系统。 只要我永远不必给 Ruby “玷污”上类型提示,也不必把所有前端代码都写成 TypeScript,我就能非常愉快地与那些热爱 Go、或者讨厌 JavaScript 的人共存。差异万岁!(Vive la différence!) One of the longest running schisms in programming is that of static vs dynamic typing. I've heard a million arguments from both sides throughout my entire career, but seen very few of them ever convinced anyone of anything. As rationalizations masquerading as reason rarely do in matters of faith. The rider will always justify the way of the elephant. That's not to say there aren't people who've switched camps. In fact, such individuals usually shout the loudest rationalizations of all. Often with the charm of a livelong omnivore suddenly turning vegan or a traditional banker who caught a lucky ride on crypto. The shorter the faith, the brighter the flame. Personally, I'm unashamedly a dynamic typing kind of guy. That's why I love Ruby so very much. It takes full advantage of dynamic typing to allow the poetic syntax that results in such beautiful code. To me, Ruby with explicit, static typing would be like a salad with a scoop of ice cream. They just don't go together. I'll also confess to having embraced the evangelical position for dynamic typing in the past. To the point of suffering from a One True Proposition affliction. Seeing the lack of enthusiasm for dynamic typing as a reflection of missing education, experience, or perhaps even competence. Oh what folly. Like trying to convince an introvert that they'd really like parties if they'd just loosen up a bit. That actually it's really fun to be in crowded rooms, for hours on end, shouting to communicate, because how about that VIBE! These days, I've come to appreciate the magnificence of multiplicity. Programming would be an awful endeavor if we were all confined to the same paradigm. Human nature is much too varied to accept such constraint on its creativity. Could you imagine if all visual art had to be rendered in the style of cubism? Or realism? Or all novels written in the short, direct flavor of Hemmingway? What a bore it would all quickly be! It would ruin the magic of programming. This unique fusion of art and engineering. But it took a while for me to come to these conclusions. I'm a recovering solutionist. So when I see folks cross their heart in disbelief that anyone, anywhere might fancy JavaScript over TypeScript, I smile, and I remember the days when I'd recognize their zeal in the mirror. That's not to say all matters of programming approaches boil down to equal but different mindsets. There are limits to this relativism. But dynamic vs static typing is certain within its confines. So too is functional vs object-oriented programming. Poles on both these axes have shown to deliver excellent software over the decades (and awful stuff too!). Now people are blessed with a capacity to express themselves equally well from either end. Such ambidextrous nature seems rare, though, as evidenced by the utter disbelief so frequently expressed by either side that the other might hold a reasonable position. I am not ambidextrous. I do not enjoy static typing, and objects animate my mind's eye. But I have come to appreciate the fact that others illuminate their creativity with just as much intensity as I do mine, using functional programming constraints and explicitly spelled out types. As long as I never have to soil my Ruby with type hints or write all front-end code in TypeScript, I can so happily coexist with those who adore Go or can't stand JavaScript. Vive la différence!

DHHCo-owner & CTO of 37signals
目录

观点原文

编程世界里持续时间最长的分裂之一,就是静态类型 vs 动态类型。在我整个职业生涯中,我听过来自双方的无数论战,但真正被说服的人却寥寥无几。因为在“信仰之争”中,披着理性外衣的合理化解释,很少真的改变任何人。骑手永远会为大象选择的道路辩护。

这并不是说没有人“改宗”。恰恰相反,这些人往往喊得最响,给出的合理化理由也最激烈。那种热情,就像一个终生的杂食者突然改吃纯素,或者一个传统银行家因为踩中一波加密行情而激情布道一样。信仰越短,火焰越旺。

就我个人而言,我毫不掩饰自己是动态类型阵营的人。这也是为什么我如此热爱 Ruby。它充分利用了动态类型的优势,成就了那种诗意的语法,写出来的代码就是漂亮。在我看来,给 Ruby 加上显式的静态类型,就像给一份沙拉挖一勺冰淇淋——它们根本不搭。

我也承认,过去我曾经站在“动态类型福音派”的位置上,甚至患上了“唯一正确命题综合征”。把别人对动态类型的冷淡,视为教育不足、经验不足,甚至能力不足的体现。

多么愚蠢啊。

这就像试图说服一个内向者:只要你放开一点,其实你会喜欢聚会的。真的,在拥挤的房间里一待就是好几个小时,为了交流而大声喊叫,多有意思啊!看看这氛围(VIBE)!

这些年,我逐渐学会欣赏多样性的壮丽。如果所有程序员都被限制在同一种范式里,编程将会是一件多么可怕的事情。人类的天性如此多样,根本无法接受对创造力施加这样的束缚。

你能想象吗?如果所有视觉艺术都必须用立体主义来表现?或者只能写写实主义?或者所有小说都必须采用海明威那种简短、直接的风格?那将会多么迅速地让人厌倦!

那会彻底毁掉编程的魔力——这种艺术与工程的独特融合。

不过,我花了很长时间才得出这些结论。我是一个“康复中的解决方案至上主义者”。所以,当我看到有人捂着胸口、满脸不可思议地问:怎么可能会有人在任何地方更喜欢 JavaScript 而不是 TypeScript?我会会心一笑,想起曾经在镜子里看到的那份狂热。

这并不是说,所有编程方法的分歧都只是“不同但平等的心态”。相对主义当然有边界。但动态 vs 静态类型显然就在这个边界之内;函数式 vs 面向对象也是如此。过去几十年里,这两个轴线两端都孕育出了极其优秀的软件(当然,也产生过糟糕透顶的东西)。

如今,人们被赋予了一种祝福:无论站在哪一端,都能同样出色地表达自己。但这种“左右开弓”的能力似乎相当罕见——否则也不会经常看到双方对“对方的立场竟然也可能合理”表现出如此强烈的震惊。

我并不是左右开弓的人。我不喜欢静态类型,对象模型能点燃我的想象力。但我已经学会欣赏这样一个事实:其他人也能用同样的热情点亮自己的创造力——通过函数式编程的约束,以及清清楚楚写明的类型系统。

只要我永远不必给 Ruby “玷污”上类型提示,也不必把所有前端代码都写成 TypeScript,我就能非常愉快地与那些热爱 Go、或者讨厌 JavaScript 的人共存。差异万岁!(Vive la différence!)

One of the longest running schisms in programming is that of static vs dynamic typing. I've heard a million arguments from both sides throughout my entire career, but seen very few of them ever convinced anyone of anything. As rationalizations masquerading as reason rarely do in matters of faith. The rider will always justify the way of the elephant.

That's not to say there aren't people who've switched camps. In fact, such individuals usually shout the loudest rationalizations of all. Often with the charm of a livelong omnivore suddenly turning vegan or a traditional banker who caught a lucky ride on crypto. The shorter the faith, the brighter the flame.

Personally, I'm unashamedly a dynamic typing kind of guy. That's why I love Ruby so very much. It takes full advantage of dynamic typing to allow the poetic syntax that results in such beautiful code. To me, Ruby with explicit, static typing would be like a salad with a scoop of ice cream. They just don't go together.

I'll also confess to having embraced the evangelical position for dynamic typing in the past. To the point of suffering from a One True Proposition affliction. Seeing the lack of enthusiasm for dynamic typing as a reflection of missing education, experience, or perhaps even competence.

Oh what folly.

Like trying to convince an introvert that they'd really like parties if they'd just loosen up a bit. That actually it's really fun to be in crowded rooms, for hours on end, shouting to communicate, because how about that VIBE!

These days, I've come to appreciate the magnificence of multiplicity. Programming would be an awful endeavor if we were all confined to the same paradigm. Human nature is much too varied to accept such constraint on its creativity.

Could you imagine if all visual art had to be rendered in the style of cubism? Or realism? Or all novels written in the short, direct flavor of Hemmingway? What a bore it would all quickly be!

It would ruin the magic of programming. This unique fusion of art and engineering.

But it took a while for me to come to these conclusions. I'm a recovering solutionist. So when I see folks cross their heart in disbelief that anyone, anywhere might fancy JavaScript over TypeScript, I smile, and I remember the days when I'd recognize their zeal in the mirror.

That's not to say all matters of programming approaches boil down to equal but different mindsets. There are limits to this relativism. But dynamic vs static typing is certain within its confines. So too is functional vs object-oriented programming. Poles on both these axes have shown to deliver excellent software over the decades (and awful stuff too!).

Now people are blessed with a capacity to express themselves equally well from either end. Such ambidextrous nature seems rare, though, as evidenced by the utter disbelief so frequently expressed by either side that the other might hold a reasonable position.

I am not ambidextrous. I do not enjoy static typing, and objects animate my mind's eye. But I have come to appreciate the fact that others illuminate their creativity with just as much intensity as I do mine, using functional programming constraints and explicitly spelled out types.

As long as I never have to soil my Ruby with type hints or write all front-end code in TypeScript, I can so happily coexist with those who adore Go or can't stand JavaScript. Vive la différence!

ABAB AI 解读

下面是站在工程哲学、认知偏好、以及“为什么技术争论总是吵不出结果”视角的深度解读。这段文字表面在谈“动态 vs 静态类型”,实际上是在拆解人类如何把技术选择变成身份信仰,以及成熟工程文化真正该如何面对分歧。

一、这不是技术之争,而是信仰之争

作者一开头就点破关键:绝大多数关于静态/动态类型的争论,从来没真正说服过任何人。

原因很简单——这类争论并不发生在“理性层”,而发生在“身份层”。

  • 你不是在为一种技术辩护
  • 你是在为“我是谁、我如何思考、我如何创造”辩护

所以他用了一句非常狠的比喻:骑手永远会为大象选择的路辩护。

理性(骑手)只是事后合理化,真正做决定的是潜意识、经验、审美、性格(大象)。

二、“改宗者最狂热”揭示了技术圈的心理补偿机制

作者对“改阵营的人”的观察极其准确:

  • 改用静态类型的人
  • 改用某种新范式的人
  • 往往会变成最激进的布道者。

这不是因为他们更“对”,而是因为:他们需要通过否定过去的自己,来证明当下选择的正确性。

这就是为什么:

  • 越是刚转 TypeScript 的人
  • 越容易对 JavaScript 表现出道德式厌恶
  • 信仰时间越短,火焰越亮。

三、Ruby 那段话真正讲的是:技术不是工具箱,而是审美系统

“给 Ruby 加静态类型,就像给沙拉挖一勺冰淇淋”,

这不是调侃,而是一个极其高级的判断:某些技术的价值,来自它们“整体的美学一致性”。

  • 动态类型
  • 诗意语法
  • 对象模型

这些不是可以随意拆装的零件,而是一整套“创作语言”。

强行混搭,技术上可能成立,但审美上是撕裂的。

四、作者真正的转变:从“解决方案至上主义”到“多样性成熟”

最重要的不是他偏爱动态类型,而是他放弃了“唯一正确答案”的执念。

他坦白承认自己曾经相信:

  • 不喜欢动态类型 = 不够聪明/不够专业
  • 而这恰恰是工程师最常见、也最危险的傲慢。

他的觉醒来自一个简单类比:就像试图说服内向者爱上派对。

技术偏好,和人格结构高度相关:

  • 有人通过约束获得安全感
  • 有人通过自由获得创造力
  • 这不是教育问题,而是神经结构差异。

五、“如果所有艺术只能一种风格”是整篇的核心隐喻

这段艺术类比不是修辞,而是工程真相:

  • 如果所有代码都必须高度类型化
  • 如果所有系统都必须函数式
  • 如果所有抽象都必须同一范式

结果不是“更正确”,而是:创造力枯竭,问题空间被压扁。

编程之所以强大,正是因为它是:工程约束 × 人类多样性 的交汇点。

六、他并没有走向“万物相对主义”

这点非常重要。

作者明确说:相对主义是有边界的。

不是所有分歧都只是“风格不同”,但动态/静态类型、函数式/面向对象,已经被几十年的实践证明:

  • 两端都能产出伟大系统
  • 两端也都能产出灾难
  • 结果取决于人,而不是范式本身。

七、真正稀缺的能力:尊重你永远不会喜欢、但确实有效的东西

作者最后达到的是一种工程成熟度的顶点:

  • 他依然不喜欢静态类型
  • 依然热爱对象模型
  • 但他承认对方的创造力同样真实
  • 这是极少数人能达到的状态。

不是“我也喜欢你那套”,而是“我不喜欢,但我尊重你用它创造价值的能力”。

八、这篇文章对今天技术圈的真正价值

在一个:

  • 技术快速更迭
  • 新工具不断被“道德化”

新范式不断被包装成“进步”的时代,这篇文章在提醒一件事:当你开始把技术偏好当成道德立场,你就已经停止学习了。

最终一句话总结(最高层)

这篇文章真正讲的不是类型系统,而是一种工程世界观:

伟大的软件,不诞生于“唯一正确的范式”,而诞生于——人类用最适合自己心智结构的工具,在约束中持续创造。

编程的魔力,不在于我们最终统一,而在于:我们允许差异,并让差异产生卓越。

Sharing

相关观点