程序员英语创作指南:常用话术与句式
程序员每天都在「创作」英语:写 commit message、填 PR 描述、留代码注释、维护接口文档、提 Issue、回外国同事的邮件。写得不地道通常不是词汇量问题,而是没掌握这套文体的固定表达。本指南整理 50 个写作核心词,按提交与评审、注释与命名、技术文档、Issue 与报错、邮件与协作五个主题分组,每个词都配一条真实写作例句;再给 25 条可直接套用的写作句式,从「能看懂」到「写得专业」。 下面按环节分组,每句都能直接套用;点右侧喇叭可以听发音,也可以到「精听跟读」页做逐句跟读。 点击任意一句即可单独播放;打开慢速后语速降到 0.8 倍,适合跟读。播放中的句子会自动高亮并滚动到可见位置。
0 / 25
提交与评审 5
Fix the null pointer when the config file is missing.
修复配置文件缺失时的空指针问题。
修 bug 类 commit,先说清楚修了什么。
Add retry logic for the payment callback.
为支付回调增加重试逻辑。
新增功能用 Add 开头,一句话说清能力。
Rename the variable for clarity; no behavior change.
为提升可读性重命名变量,无行为变更。
纯重构类提交主动声明无行为变更。
Could you take a look when you have time?
你有空的时候能看一下吗?
请求评审最常用的礼貌句式。
Nit: this line is longer than the linter limit.
小意见:这行超过了 linter 的长度限制。
Nit 表示小建议,不阻塞合并。
注释与命名 5
Returns the cached page, or nil if it is not in the cache.
返回缓存页面;若不在缓存中则返回 nil。
文档字符串用第三人称描述返回值。
TODO: extract this block into a helper once the API is stable.
待办:等接口稳定后把这段抽成公共方法。
TODO 要写清做什么以及什么时候做。
The name should describe what it returns, not how it works.
命名要说明返回什么,而不是怎么实现。
评审沟通命名时的标准说法。
Avoid comments that simply repeat the code.
避免写只是重复代码本身的注释。
解释 why,而不是 what。
Mark it as deprecated and point to the replacement.
标记为已弃用,并指向替代方案。
弃用要给出迁移路径。
技术文档 5
This section explains how to configure the service.
本节说明如何配置该服务。
文档开头的导览句。
Here is a minimal example you can copy.
这里有一个可以直接复制的最小示例。
minimal example 是文档里最有价值的部分。
Note that the API is rate limited to 100 requests per minute.
注意该接口限流为每分钟 100 次。
Note that 引出限制条件。
Prerequisites: Go 1.24 and a running MySQL instance.
前置条件:Go 1.24 和一个可用的 MySQL 实例。
安装类文档先写前置条件。
See the troubleshooting section if the port is already in use.
如果端口被占用,请查看故障排查章节。
用 See 引导跳转,避免重复内容。
Issue 与报错 5
Steps to reproduce: open the settings page and click save.
复现步骤:打开设置页并点击保存。
Issue 里最容易被忽略、又最关键的一段。
Expected: the form saves. Actual: the page reloads and data is lost.
预期:表单保存成功。实际:页面刷新且数据丢失。
Expected / Actual 对照写法,一眼看清问题。
I can reproduce it on iOS 17 but not on Android.
我在 iOS 17 上能复现,安卓上不能。
主动给出环境差异,节省排查时间。
As a workaround, clear the local cache.
临时方案是清空本地缓存。
As a workaround 是报临时方案的固定说法。
This looks like a regression from the last release.
这看起来是上个版本引入的回归缺陷。
looks like 留有余地,不下断言。
邮件与协作 5
Thanks for the quick turnaround.
感谢快速处理。
turnaround 指从提出到完成的时间。
Sorry for the late reply; I was travelling.
抱歉回复晚了,我在出差。
先道歉再进入正题,是英文邮件的习惯。
Just to clarify, we need the change before Friday.
澄清一下,我们需要在周五之前完成改动。
Just to clarify 用于消除歧义。
I have added the details to the attached document.
我已经把细节补充在附件文档里。
提附件时说清里面有什么。
I will follow up if I do not hear back by Thursday.
如果周四前没有回复,我会再跟进一次。
给出预期时间,推动对方回应。
发音使用浏览器内置语音合成,不同手机的嗓音会略有差异;iOS 需先点一次页面才允许发声。