代码的可读性,首先从命名开始。
嵌入式软件开发时变量、函数等命名,曾遇见单片机MCU翻译为singlechip,字母大小转换使用big/small;或使用LY表示录音;或使用analog_to_digital_converter全称表示ADC。功能运行正常就拒绝改进,这种现象正如吃饭发现了头发,影响心情但确实不致死;更有甚者使用字母l表示length长度,最后莫名其妙地写成了数字1导致严重问题。
软件开发中的命名,尤其是约定俗成的词汇应该优先使用,本文整理了500个常用英文以便规范化。
序号 | 英文 | 缩写 | 中文 | 备注/关联 |
---|---|---|---|---|
0 | abstract | abs | 抽象的 | |
1 | access | acc | 存取,访问 | |
2 | account | 账户 | ||
3 | acknowledge | ack | 承认,应答 | |
4 | acquisition | acq | 获取 | |
5 | action | 动作 | ||
6 | activate | 激活 | ||
7 | actual | act | 实际 | |
8 | adaptation | adapt | 适应 | |
9 | adapter | 适配器 | ||
10 | add | add | 添加 | sub |
11 | add-in | 插件 | ||
12 | address | addr | 地址 | |
13 | administration,administrator | admin | 管理,管理员 | 微信公众号【嵌入式系统】 |
14 | advanced | 高级的 | ||
15 | advertisement | adv | 广播 | BLE |
16 | agent | 代理 | ||
17 | algorithm | alg | 算法 | |
18 | allocate | alloc | 分配、配置 | |
19 | alternate | alt | 交替 | |
20 | analog-to-digital converter | adc | 模数转换器 | |
21 | analysis | anal | 分析 | |
22 | answer | ans | 答案 | |
23 | append | 附加 | ||
24 | application | app | 应用程序 | |
25 | architecture | arch | 架构 | |
26 | argument | arg | 参数 | param |
27 | array | arr | 数组 | |
28 | assertion | assert | 断言 | |
29 | assign | 赋值 | ||
30 | asynchronous | 异步的 | UART | |
31 | attachment | attach | 附件 | |
32 | attribute | attr | 特性,属性 | |
33 | authorization | 授权 | ||
34 | automatic | auto | 自动的 | |
35 | auxiliary | aux | 辅助 | |
36 | available | avail | 可用的 | |
37 | average | avg | 平均值 | |
38 | back | bk | 后退 | |
39 | background | bg | 背景 | |
40 | backup | 备份 | ||
41 | base type | 基类型 | ||
42 | batch | 批处理 | ||
43 | begin | begin | 开始 | end |
44 | binary | 二进制 | ||
45 | binding | 绑定 | ||
46 | bit | bit | 位 | |
47 | block | 块,区块 | ||
48 | bootloader | bl | 启动加载器 | |
49 | boundary | bound | 边界 | |
50 | breakpoint | 断点 | ||
51 | bridge | bridge | 桥 | |
52 | broadcast | bc | 广播 | adv |
53 | buffer | buff | 缓冲区 | cache |
54 | built-in | 内置 | ||
55 | bus | 总线 | ||
56 | business | 业务 | ||
57 | button | btn | 按钮 | |
58 | cache | 缓存 | buff | |
59 | calculate | calc | 计算 | |
60 | calibration | calib | 校准 | |
61 | callback | cb | 回调 | |
62 | capacity | cap | 容量 | |
63 | category | cat | 类别 | |
64 | certification | cert | 认证 | |
65 | change | chg | 改变 | |
66 | channel | ch | 通道 | |
67 | characteristic | charac | 特征 | |
68 | check | chk | 检测 | |
69 | checksum | checksum | 校验和 | |
70 | circulation | circ | 循环 | |
71 | clean | 清理 | ||
72 | click | clk | 点击 | |
73 | client | client | 客户端 | server |
74 | clock | clk | 时钟 | |
75 | clone | 克隆 | ||
76 | close | close | 关闭 | open |
77 | collection | 集合 | ||
78 | color | clr | 颜色 | |
79 | column | col | 列 | row |
80 | combine | comb | 组合 | |
81 | command | cmd | 命令 | |
82 | comment | 注释 | ||
83 | commit | 提交 | ||
84 | common | com | 公共的 | |
85 | communication | comm | 通信 | |
86 | comparison | comp | 比较 | |
87 | compensation | comp | 补偿 | |
88 | compiler | 编译器 | ||
89 | completion | complet | 完成 | |
90 | component | com | 组件 | |
91 | condition | cond | 条件 | |
92 | configuration | config | 配置 | set |
93 | confirmation | confirm | 确认 | |
94 | connect | conn | 连接 | disconnect |
95 | console | 控制台 | ||
96 | consolidation | consol | 合并 | |
97 | constant | const | 常量 | |
98 | consumption | consump | 消费 | |
99 | container | cont | 容器 | |
100 | content | cont | 内容 | |
101 | context | 上下文 | ||
102 | continue | continue | 继续 | |
103 | control | ctrl | 控制,控件 | |
104 | conversion | conv | 转换 | |
105 | convert | 使转变 | ||
106 | coordinates | coord | 坐标系 | |
107 | copy | cpy | 复制 | |
108 | count | cnt | 计数 | |
109 | cover | 覆盖、涵盖 | ||
110 | create | create | 创建 | delete,destroy |
111 | current | I,curr | 电流,当前 | |
112 | custom,customer | cust | 定制、自定义 | |
113 | data | data | 数据 | |
114 | database | db | 数据库 | |
115 | deadline | deadln | 截止日期 | |
116 | decode | dec | 解码 | encode |
117 | decrease | dec | 减少 | |
118 | decrement | dec | 递减 | inc |
119 | decrypt | decrypt | 解密 | encrypt |
120 | default | def | 默认 | |
121 | delay | delay | 延迟 | |
122 | delete | del | 删除 | create |
123 | delivery | deliv | 交付 | |
124 | demonstration | demo | 示范 | |
125 | description | desc | 描述 | |
126 | design | des | 设计 | |
127 | destination | dest | 预定,指定 | |
128 | destroy | destroy | 销毁 | create |
129 | detection | detect | 检测 | |
130 | development | dev | 开发 | |
131 | device | dev | 设备 | |
132 | dialog | dlg | 对话框 | |
133 | dictionary | dict | 字典 | |
134 | difference,different | diff | 差异 | |
135 | direction | direct | 方向 | |
136 | directory | dir | 目录 | |
137 | disable | dis | 禁用 | enable |
138 | disconnect | disc | 断开连接 | |
139 | display | disp | 显示 | |
140 | distance | dist | 距离 | |
141 | document | doc | 文档 | |
142 | domain | dom | 领域 | |
143 | down | dn | 向下 | |
144 | download | dl | 下载 | |
145 | driver | drv | 驱动 | |
146 | duration | dur | 持续时间 | |
147 | dynamic | dyn | 动态的 | |
148 | effectiveness | effect | 有效性 | |
149 | efficiency | eff | 效率 | |
150 | electronic mail | 电子邮件 | ||
151 | element | elem | 元素 | |
152 | embedded system | 微信公众号 | 嵌入式系统 | 重点关注 |
153 | emergency | emerg | 紧急情况 | |
154 | emphasis | emph | 强调 | |
155 | enable | en | 使能 | disable |
156 | encode | enc | 编码 | decode |
157 | encrypt | encrypt | 加密 | decrypt |
158 | end | end | 结束 | |
159 | enhancement | enhance | 增强 | |
160 | enter | 进入 | exit | |
161 | entity | 实体 | ||
162 | environment | env | 运行环境 | |
163 | equipment | equip | 设备 | |
164 | error | err | 错误 | |
165 | event | event | 事件 | |
166 | example | ex | 示例 | |
167 | exception | except | 例外 | |
168 | exchange | exch | 交换 | |
169 | execute | exec | 执行 | |
170 | exist | exist | 存在 | |
171 | exit | 退出 | enter | |
172 | expansion | expans | 扩展 | |
173 | expect | exp | 期望 | |
174 | experiment | expmt | 实验 | |
175 | explanation | expl | 解释 | |
176 | export | exp | 出口,导出 | import |
177 | extension | ext | 扩展 | |
178 | external | ext | 外部的 | |
179 | failure | fail | 失败 | ok |
180 | feedback | fb | 反馈 | |
181 | field | field | 域 | |
182 | file | fl | 文件 | |
183 | firmware | fw | 固件 | |
184 | first | first | 第一位 | |
185 | flag | flag | 标志位 | 万能 |
186 | flush | 刷新 | file write | |
187 | focus | foc | 焦点 | |
188 | font | 字体 | ||
189 | force | 强制 | ||
190 | format | fmt | 格式 | |
191 | forward | fwd | 转发,向前 | |
192 | foundation | found | 基础 | |
193 | frame | frm | 帧率 | |
194 | framework | framewk | 框架 | |
195 | frequency | freq | 频率 | |
196 | function | func | 函数 | |
197 | general purpose input/output | gpio | 通用输入输出端口 | |
198 | generate | gen | 生成 | |
199 | generation | gener | 代 | |
200 | get | get | 获取 | set,take |
201 | global | 全局的 | ||
202 | group | grp | 组 | |
203 | handle | hdl | 句柄 | |
204 | handler | 处理器 | ||
205 | handshake | hdsk | 握手 | |
206 | hardware | HW | 硬件 | |
207 | header | hdr | 头部 | tail |
208 | heap | heap | 堆 | |
209 | high | high | 高 | low |
210 | highlight | highlt | 强调 | |
211 | hook | 钩子 | ||
212 | horizontal | horz | 水平的 | vertical |
213 | identifier | ID | 标识符,身份 | 微信公众号【嵌入式系统】 |
214 | idle | 空闲时间 | ||
215 | image | img | 图像 | |
216 | implementation | implement | 实施 | |
217 | import | 导入 | export | |
218 | importance | imp | 重要性 | |
219 | include | incl | 包含头文件 | |
220 | inclusion | inclus | 包含 | |
221 | increase | inc | 增加 | |
222 | incremental | inc | 递增 | dec |
223 | index | idx,ind | 索引 | |
224 | information | info | 信息 | |
225 | initialize | init | 初始化 | deinit |
226 | input | in | 输入 | output |
227 | insert | insert | 插入 | |
228 | installation | install | 安装 | |
229 | instance | inst | 实例 | |
230 | instruction | instruct | 指令 | cmd |
231 | instrument | instr | 工具 | |
232 | integration | int | 整合 | |
233 | integrity | integr | 完整性 | |
234 | interface | iface | 接口 | |
235 | internal | int | 内部的 | |
236 | international | inter | 国际的 | |
237 | interrupt | intr | 中断,中断请求IRQ | |
238 | interval | interv | 间隔 | |
239 | introduce | intro | 介绍 | |
240 | item | item | 项、条款、项目 | |
241 | iterate | 迭代 | ||
242 | key | key | 键值 | |
243 | language | lang | 语言 | |
244 | last | last | 最后的 | |
245 | length | len,not l | 长度 | |
246 | level | level | 电平 | |
247 | library | lib | 静态库 | |
248 | lifetime | 生命期、寿命 | ||
249 | limitation | limit | 限制 | |
250 | link | lnk | 链接 | |
251 | list | lst | 列表 | |
252 | load | 装载、加载 | ||
253 | location | loc | 位置 | |
254 | lock | lock | 锁 | unlock |
255 | log | log | 日志 | |
256 | logical | logic | 逻辑的 | |
257 | login | 登录 | ||
258 | loop | loop | 循环 | |
259 | low | low | 低 | high |
260 | macro | macro | 宏 | |
261 | mailbox | mbx | 邮箱 | |
262 | mask | mask | 屏蔽码,掩码 | |
263 | master | mst | 主机 | I2C |
264 | mathematics | math | 数学 | |
265 | maximum | max | 最大值 | min |
266 | medium | medium | 中 | |
267 | membership | member | 成员 | |
268 | memory | mem | 内存 | |
269 | memory leak | 内存泄漏 | ||
270 | menu | 菜单 | ||
271 | message | msg | 消息 | |
272 | metadata | 元数据 | ||
273 | methodology | method | 方法 | |
274 | microphone | mic | 麦克风 | |
275 | middle | mid | 中间 | |
276 | middleware | 中间件 | ||
277 | minimum | min | 最小值 | max |
278 | mode | mode | 模式 | |
279 | modem | 调制解调器 | ||
280 | modify | modify | 修改 | |
281 | module | mod | 模块 | |
282 | multi | 多种 | ||
283 | multiply | mul | 相乘 | |
284 | native | 原生的、本地的 | ||
285 | network | net,nw | 网络 | |
286 | new | new | 新的 | |
287 | next | next | 后一个 | |
288 | nominal | nom | 理论值 | |
289 | nonvolatile | nv | 非易失性的 | |
290 | notify | notify | 通知 | |
291 | number | num | 数字 | |
292 | object | obj | 对象 | |
293 | offset | offset | 偏移 | |
294 | old | old | 旧的 | new |
295 | opcode | opc | 操作码 | |
296 | open | open | 打开 | close |
297 | operation | op | 操作 | |
298 | option | opt | 选择 | |
299 | organization | org | 组织 | |
300 | orientation | orient | 方向 | |
301 | origin | org | 起源 | |
302 | output | out | 输出 | input |
303 | overflow | overflow | 溢出 | |
304 | overload | 重载 | ||
305 | override | 重写 | ||
306 | owner,ownership | own | 拥有 | |
307 | package | pkg | 打包 | |
308 | packet | pkt | 包 | |
309 | parameter | param | 参数 | |
310 | parity | parity | 奇偶校验 | |
311 | parse | 解析 | ||
312 | part | 部件 | ||
313 | password | pass,psw | 密码 | |
314 | payment | pay | 支付 | |
315 | peak | peak | 峰值 | |
316 | performance | perform | 表现 | |
317 | performance | perf | 性能 | |
318 | period | period | 周期 | |
319 | permission | perm | 许可 | |
320 | perspective | persp | 角度 | |
321 | phase | phase | 相位 | |
322 | picture | pic | 图片 | |
323 | planning | plan | 计划 | |
324 | platform | plat | 平台 | |
325 | point | pt | 点 | |
326 | pointer | ptr | 指针 | |
327 | policy | pol | 政策 | |
328 | popup | 弹出 | ||
329 | port | port | 端口 | |
330 | position | pos | 位置 | |
331 | postfix | 后缀 | suffix | |
332 | power | P,pwr | 功率,电源 | |
333 | prefix | pfx | 前缀 | |
334 | preparation | pre | 准备 | |
335 | pressure | press | 压力 | |
336 | prevention | prevent | 预防 | |
337 | previous | prev | 前一个 | next |
338 | prn | 打印 | ||
339 | priority | prio | 优先级 | |
340 | private | priv | 私有的 | |
341 | privilege | priv | 特权 | |
342 | procedure | proced | 程序,步骤 | |
343 | process | proc | 进程 | |
344 | production | produc | 生产 | |
345 | program | prog | 程序 | |
346 | progress | prog | 进展 | |
347 | project | proj | 项目、工程 | |
348 | properties | 性能 | ||
349 | property | prop | 属性 | |
350 | protected | prot | 受保护 | |
351 | protocol | 协议 | ||
352 | public | pub | 公共的 | |
353 | pull-down | pd | 下拉 | |
354 | pull-up | pu | 上拉 | |
355 | quantity | quant | 数量 | |
356 | queue | qu | 队列 | |
357 | range | 范围、区间 | ||
358 | ratio | ratio | 比率 | |
359 | raw | 未经处理的 | ||
360 | reaction | react | 反应 | |
361 | read | read | 读取 | |
362 | readonly | 只读 | ||
363 | ready | rdy | 准备 | |
364 | reality | real | 现实 | |
365 | receive | rcv | 接收 | send |
366 | reception | recept | 接待 | |
367 | recommendation | recommend | 推荐 | |
368 | record | 记录 | ||
369 | recovery | recovery | 恢复 | |
370 | rect | rc | 矩形 | |
371 | recycling | recycl | 回收 | |
372 | redefine | 重定义 | ||
373 | redundancy | redund | 冗余 | |
374 | refactoring | 重构 | ||
375 | reference | ref | 引用,参考 | |
376 | region | region | 地区 | |
377 | register | reg | 注册,寄存器 | |
378 | regression | rgr | 回归 | |
379 | regulation | regul | 规定 | |
380 | rejection | reject | 拒绝 | |
381 | release | rel | 发布 | |
382 | reminder | remind | 提醒 | |
383 | remote | 远程 | ||
384 | removal | rm | 移除 | delete |
385 | repetition | repet | 重复 | |
386 | request | req | 请求 | |
387 | reservation | reserv | 预订 | |
388 | reserved | rsvd | 保留 | |
389 | resolution | res | 分辨率 | |
390 | resource | res | 资源 | |
391 | response | rsp | 回复 | |
392 | restriction | restrict | 限制 | |
393 | result | res | 结果 | |
394 | resume | resume | 恢复 | suspend |
395 | retention | retent | 保留 | |
396 | return | ret | 返回 | |
397 | ringbuffer | 环形缓冲区 | ||
398 | risk | risk | 风险 | |
399 | row | row | 行 | |
400 | safety | saf | 安全 | |
401 | sample | sampl | 样本 | |
402 | sampling | samp | 采样 | |
403 | save | 保存 | ||
404 | scale | scale | 比例尺 | |
405 | scan | 扫描 | BLE,search | |
406 | schedule | sched | 调度,安排 | |
407 | scheme | sch | 方案 | |
408 | scope | scope | 范围 | |
409 | screen | scr | 屏幕 | |
410 | search | 查找 | scan | |
411 | second | sec | 秒、第二 | |
412 | secrecy | secret | 保密 | |
413 | select | sel | 选择 | |
414 | semaphore | sem | 信号量 | |
415 | send | send | 发送 | |
416 | sensor | sensor | 传感器 | |
417 | separation | separ | 分离 | |
418 | sequence | seq | 序列 | |
419 | serial | 串行 | ||
420 | server | svr | 服务 | 微信公众号【嵌入式系统】 |
421 | set | set | 设置,集合 | |
422 | sharing | shar | 分享 | |
423 | shift | shift | 移位 | |
424 | signal | sig | 信号 | |
425 | simplicity | simpl | 简单 | |
426 | simulation | simul | 模拟 | |
427 | situation | situat | 情况 | |
428 | size | sz | 大小 | |
429 | skew | skew | 偏斜 | |
430 | skill | skill | 技能 | |
431 | slave | slv | 从机 | master,I2C |
432 | slope | slope | 斜率 | |
433 | software | SW | 软件 | |
434 | solution | solut | 解决方法 | |
435 | source | src | 源头 | |
436 | space | space | 空间 | |
437 | stability | stabil | 稳定性 | |
438 | stack | stk | 栈 | |
439 | standard | std | 标准 | |
440 | start | start | 开始 | stop |
441 | state | state | 状态 | |
442 | statistic | stats | 统计 | |
443 | status | status | 状态 | |
444 | step | step | 步进 | |
445 | stop | stop | 停止 | start |
446 | storage | stor | 存储 | |
447 | stream | stm | 流 | |
448 | string | str | 字符串 | |
449 | subtract | sub | 减去 | add |
450 | suffix | sfx | 后缀 | postfix |
451 | summation | sum | 求和 | |
452 | support | 支持 | ||
453 | surplus | surpl | 剩余 | freesize |
454 | suspend | suspend | 暂停,挂起 | resume |
455 | switch | sw | 开关 | |
456 | symbol | 记号 | ||
457 | synchronize | sync | 同步 | |
458 | syntax | 语法 | ||
459 | system | sys | 系统 | |
460 | table | tbl | 表 | |
461 | target | tar | 目标 | |
462 | temperature | temp | 温度 | |
463 | temporary | temp | 临时 | |
464 | terminal | term | 终端 | |
465 | terminate | term | 终止 | |
466 | test | test | 测试 | |
467 | text | txt | 文本 | |
468 | threshold | thresh | 阈值 | |
469 | time | t | 时间 | |
470 | timer | timer | 定时器 | |
471 | total | tot | 总共 | |
472 | transfer | trf | 转移 | |
473 | transmission | trans | 传输 | |
474 | trigger | trig | 触发 | |
475 | underflow | underflow | 下溢 | |
476 | unknown | unk | 未知 | 微信公众号【嵌入式系统】 |
477 | unlock | unlock | 解锁 | lock |
478 | up | up | 向上 | |
479 | update | upd | 更新 | |
480 | upgrade | upg | 升级 | |
481 | urgent | urg | 紧急 | |
482 | user | usr | 用户 | |
483 | util | util | 工具 | tool |
484 | valid | vld | 有效的 | |
485 | validation | val | 验证 | |
486 | value | val | 值 | |
487 | variable | var | 变量 | |
488 | vector | vec | 向量 | |
489 | vendor | 厂商 | manufacturer | |
490 | verification | vrf | 验证 | |
491 | version | ver | 版本 | |
492 | vertical | vert | 垂直的 | horizontal |
493 | virtual | virt | 虚拟 | |
494 | voltage | volt | 电压 | |
495 | watchdog | wdt | 看门狗 | |
496 | weight | wt | 权重 | |
497 | width | wid | 宽度 | length |
498 | window | win | 窗口 | |
499 | word | word | 字 | |
500 | write | write | 写入 | read |