程序员英语 02:技术词汇与句子骨架
遇到 The worker drains the queue before shutdown.,逐词查到“工人、排水、队伍”并不能帮助理解。开发语境中的意思是:工作线程或进程在关闭前处理完队列里的待处理项。先确认对象和动作,再确定词义。
把词汇放进动作里
| 搭配 | 在开发中的常见含义 | 原创例句 |
|---|---|---|
| parse a file | 按格式解析文件 | The parser rejects incomplete records. |
| validate input | 校验输入 | Validate the length before saving the value. |
| allocate memory | 分配内存 | The buffer allocates memory on demand. |
| release a lock | 释放锁 | Release the lock before running the callback. |
| handle an error | 处理错误 | The caller handles missing files. |
| raise an exception | 抛出异常 | The loader raises an exception for invalid syntax. |
| resolve a dependency | 解析或确定依赖 | The build tool resolves dependencies before compilation. |
| persist a change | 持久化修改 | The editor persists changes when you save. |
| retry an operation | 重试操作 | Retry the operation after checking the cause. |
| reproduce a failure | 复现失败 | I can reproduce the failure with this input. |
| backward compatible | 向后兼容 | The new reader is backward compatible with version 2 files. |
| deprecated | 已不推荐使用 | This option is deprecated but still accepted in this version. |
同一个词随上下文改变含义:resolve a dependency 与 resolve an issue 的对象不同;argument 在函数调用里通常是实参,在讨论中可能是论点。词汇卡应记录完整搭配,避免只写一个中文对应词。
deprecated 不等于已经删除,removed 才表示移除;concurrent 强调任务在时间上交错推进,parallel 强调同时执行。读到这些词后,还要找版本与执行模型,不能只凭词表推断具体产品行为。
先找句子主干,再加限定
看这句原创说明:
The cache stores values that are expensive to compute until they expire.
先抽出主干:The cache / stores / values,即缓存存储值。that are expensive to compute 修饰 values,说明是哪类值。until they expire 补充保留多久,they 指这些值。
按这个顺序阅读,比从左到右逐字翻译更容易保住整体含义:
- 谁做事:cache。
- 做什么:stores。
- 对什么做:values。
- 哪些值、何时结束:计算成本高,直到过期。
如果句子指代不清,不必猜作者意思。例如 The worker passes the buffer to the parser after it starts. 中 it 可能指 worker,也可能指 parser。写作时应直接重复名称。
几组会改变实现的表达
| 表达 | 应保留的逻辑 |
|---|---|
| at least 3 | 不少于 3,包含 3 |
| at most 3 | 不多于 3,包含 3 |
| fewer than 3 | 少于 3,不包含 3 |
| only if the file exists | 文件存在是必要条件,不保证一定执行 |
| unless the file exists | 除非文件存在,否则执行所述行为 |
| may fail | 可能失败,不是在报告已失败 |
| has failed | 已经发生失败 |
练习:保留技术含义
- 翻译
The reader accepts at most 16 records unless strict mode is enabled.,并指出不能确定的内容。 - 把
The worker passes the buffer to the parser after it starts.改成明确表达“解析器启动后再传入”的句子。 - 说明
The option is deprecated in version 4.能否证明第 4 版已经不接受该选项。
查看答案与讲解
- 未启用严格模式时,读取器最多接受 16 条记录。严格模式启用后接受多少条,原句没有说明;不要自行补成零条或无限条。
After the parser starts, the worker passes the buffer to it.这里it有清晰指向;也可直接重复the parser。- 不能。需要另查移除计划和当前版本行为。可以表述为
The option is deprecated; check the migration guide for its replacement and removal schedule.
资料与延伸
Google 开发者文档词汇表 可用于核对特定术语与写作惯例。它是编辑风格参考,不是所有项目必须遵守的词典。团队已有术语时,优先保持同一文档内的一致性。
继续阅读
- 读写与对话练习
- 句法与表达查阅
- 句法与表达查阅