The importance of understanding what is going on
本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。
The importance of understanding what is going on
We have […] arranged things so that almost no one understands science and technology. This is a prescription for disaster. We might get away with it for a while, but sooner or later this combustible mixture of ignorance and power is going to blow up in our faces.
我们已经……安排好了一切,以至于几乎没有人理解科学和技术。这简直是灾难的处方。我们或许能侥幸维持一段时间,但迟早,这种由无知与权力构成的易燃混合物会在我们面前爆炸。
I apologise for the downbeat tone of my last post to all that came across it. As it turns out I’m human too and sometimes I have days where it feels like the world is slowly ending. This one has more spring to its step.
对于上一篇文章中消极的基调,我向所有读到它的读者致歉。事实证明我也是凡人,有时也会觉得世界正在慢慢走向终结。而今天这一篇则更有活力一些。
The other day I was reading Ian Duncan’s response to Justin Michael’s blog post and it hit me that both are talking about different things. Michael is speaking from experience and observation. Duncan, in contrast, is envisioning a world that could be; that he hopes is the one we live in; but ultimately is not real. This post is not a response to either, but I want to credit both for getting me thinking about the topics contained herein. And, for inspiring me to swear in my post title.
前几天我读了 Ian Duncan 对 Justin Michael 博客文章的回应,突然意识到他们谈论的是完全不同的事情。Michael 是基于经验和观察在发言。相比之下,Duncan 设想的是一个可能存在的世界;一个他希望我们正身处其中的世界;但归根结底,那并非现实。这篇文章并非对他们任何一方的回应,但我还是要感谢他们让我开始思考文中的这些议题。也感谢他们启发我在标题里用了脏话。
I have recently been blessed/cursed with the responsibility of being the technical lead for a large-ish project at my day job. There are nice things to say about this, although the stress of having to see one’s own ideas about how software engineering should be done put into practice is draining. It’s one thing to crow from the sidelines and quite another to be the person at which the buck stops. So far I feel happy that things are playing out broadly as I hoped, but I am not an optimist by nature, so this is not much of a reassurance.
最近,我被赋予(或者说被诅咒)了一项职责,担任我日常工作中一个大型项目的技术负责人。这件事有其美好的一面,尽管看着自己关于软件工程应该如何实施的想法被付诸实践,这种压力非常消耗精力。在场边指手画脚是一回事,而成为那个最终负责的人则是另一回事。到目前为止,我很高兴事情的发展大体如我所愿,但我天生不是乐观主义者,所以这并不能让我感到多少宽慰。
As part of this work I’ve had the opportunity to spend time helping more junior engineers in the team develop their skills; all the way from those that are just a few years behind me in experience, to those fresh out of university. It’s quickly becoming apparent to me that the opportunity to be a part of their journey toward becoming accomplished engineers, and the chance to learn from them to improve myself, might end up being the thing I look back on as the high point of my career.
作为这项工作的一部分,我有机会花时间帮助团队中更年轻的工程师提升技能;从那些经验只比我少几年的人,到刚从大学毕业的新人。我很快意识到,能够参与他们成长为优秀工程师的旅程,并有机会向他们学习以提升自我,这可能最终会成为我回首职业生涯时最引以为傲的高光时刻。
A large part of our job is the task of coming to terms with a very large codebase that pre-dates our involvement. By and large it is lacking documentation, but is nominally functional. Its complexity cuts across many lines of abstraction and its code refuses to be constrained to a single layer of the traditional software stack. I have days in which my conversations veer between topics as alien to one-another as capacitance, cache line invalidation, and JavaScript promise cancellation. It is often impenetrable, and the outputs it gives in its native environment are often perilously difficult to correlate with the inputs provided to it. Many of these challenges are inherent to the domain and are unavoidable. Some are not.
我们工作很大一部分内容是去理解一个在我们加入之前就已存在的大型代码库。它基本上缺乏文档,但名义上是可以运行的。它的复杂性跨越了许多抽象层,代码也不愿被局限在传统软件栈的单一层级中。有时,我的对话会在电容、缓存行失效和 JavaScript Promise 取消这些互不相关的领域之间跳跃。它往往令人难以捉摸,在原生环境中产生的输出,也常常极难与输入的参数建立关联。这些挑战中,许多是该领域固有的,不可避免;但也有一些并非如此。
I have always maintained that the greatest skill a software engineer can have is the ability to resist sliding into mysticism, but this codebase has tested me like no other. In this god-forsaken industry with few standards, little regulation, and no social memory, it’s made me realise that the dividing line that separates mere programmers from genuine software engineers is their reaction to the unexpected.
我一直坚持认为,软件工程师最重要的技能是抵御神秘主义倾向的能力,但这个代码库对我的考验前所未有。在这个缺乏标准、监管薄弱且没有社会记忆的鬼地方行业里,它让我意识到,区分普通程序员与真正软件工程师的分水岭,在于他们对意外情况的反应。
How many times have you made a seemingly innocuous change only to see a long-standing bug vanish? How often have you tweaked a supposedly inconsequential tuning parameter only to see a system start dropping jobs at random? To a programmer, these are a sign from above: follow the hint and move on. For an engineer, they’re a clue to something deeper going on that warrants investigation.
你做过多少次看似无害的修改,却发现一个长期存在的 Bug 消失了?你调整过多少次看似无关紧要的参数,却发现系统开始随机丢弃任务?对于程序员来说,这些是来自上天的启示:顺着线索走下去就行了。但对于工程师来说,这些是更深层问题的线索,值得深入调查。
It’s an uphill battle these days, and it seems like many have given up. ‘Give it to Claude’. If I could tell junior engineers anything, it’s to resist that siren call. Engineers are a patchwork of battle scars, and each one tells a story of a confrontation with the unexpected. Finding the solution might give you immediate joy, or it might make your boss happy, but you will learn so much more by uncovering the negative space that sits around the solution than you ever will by passing the problem on. In an age of ever-easier answers that no longer require even understanding the question, it’s critical to understand that the interests of your boss and your own career have diverged: you must fight for the space to learn.
如今这是一场艰难的战斗,似乎许多人已经放弃了。“交给 Claude 吧。”如果我能给初级工程师什么建议,那就是抵御这种诱惑。工程师是伤痕累累的集合体,每一道伤疤都讲述着一个与意外对抗的故事。找到解决方案可能会让你获得即时的快乐,或者让你的老板满意,但通过挖掘解决方案周围的“负空间”所学到的东西,远比直接把问题转手他人要多得多。在这个答案唾手可得、甚至不再需要理解问题的时代,必须明白你老板的利益与你个人的职业生涯已经分道扬镳:你必须为自己的学习空间而战。
My greatest fear is that we are creating a world that is too complex for its inhabitants to understand. That’s a problem not just for engineers, but for democracy. When a system becomes unknowable to its subjects, no matter how individually rational its constituents parts, the only means of reasoning with it is prayer. We may not be creating a god, but we’re certainly turning ourselves into worshippers. You should ask yourself whose interests this serves, and act appropriately.
我最大的恐惧是,我们正在创造一个对于居住其中的人来说过于复杂的世界。这不仅是工程师的问题,也是民主的问题。当一个系统对其主体变得不可知时,无论其组成部分在个体上多么理性,与之沟通的唯一方式就只剩下祈祷了。我们或许没有在创造神,但我们确实正在把自己变成信徒。你应该问问自己,这符合谁的利益,并采取相应的行动。
I also have the pleasure of working with a more senior engineer who’s been through it all before with a similar system. Sometimes I like to think myself an engineer, but then one of us will encounter an issue that, by all rights, seems impossible: perhaps a function being called with no caller in sight, or a machine that’s monologuing to itself instead of chatting to its neighbour. The temptation to revert the last change on a whim lingers in the air, but instead I turn to them for advice.
我还有幸与一位资深工程师共事,他曾在类似的系统中经历过这一切。有时我喜欢自诩为工程师,但随后我们中的一人就会遇到一个按理说不可能出现的问题:比如一个函数被调用了,却找不到调用者;或者一台机器在自言自语,而不是与邻近的机器通信。那种随手撤销上一次修改的冲动在空气中弥漫,但我还是选择向他寻求建议。
5 minutes later and they’re back with an answer.
5 分钟后,他带着答案回来了。
“Those symptoms look similar to something I found 5 years ago. Back then, I spent a day walking back through the system and traced the issue to a bug in the dynamic linker. It doesn’t handle unaligned ELF segments properly: if a segment other than .text contains ARM/Thumb interworking, the linker will misalign the code and the CPU will interpret your ARM function as Thumb. By chance, part of libc, which only gets inlined with these specific set of compiler flags, looks very much like a syscall instruction after it’s been offset by a half-word, and that’s why you’re seeing a crash on a syscall ID that doesn’t exist. I found the bug in the linker and patched it back then. Here’s the diff.”
“这些症状看起来和我 5 年前发现的问题很像。当时,我花了一天时间回溯系统,最终追踪到动态链接器里的一个 Bug。它不能正确处理未对齐的 ELF 段:如果除了 .text 之外的段包含 ARM/Thumb 互操作代码,链接器就会导致代码错位,CPU 会把你的 ARM 函数误读为 Thumb 指令。碰巧的是,libc 的一部分代码在特定编译器标志下被内联后,偏移半个字长后看起来非常像一条系统调用指令,这就是为什么你会看到系统在一个不存在的系统调用 ID 上崩溃。我当时发现了链接器的这个 Bug 并修复了它。这是补丁。”