约定:为函数和关键字声明选择最佳的英文名称 [英] Convention: Choosing the best english names for functions and keywords declaration

查看:98
本文介绍了约定:为函数和关键字声明选择最佳的英文名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我想知道是否有关于为函数和关键字声明选择最佳英文名称的约定.
我花了很多时间决定在C或C ++编程中命名函数或关键字,因为我的英语水平很差,而且英语中有很多同义词.
当然,存在以 Is Can Has 或任何其他布尔表达式开头的布尔名称.
有同义词单词(即 Display Show )时该选择什么!?

谢谢您的理解.

Hello,
I want to know if there is a convention about choosing the best English names for functions and keywords declaration.
I spend many time to make a decision to name a function or a keyword in C or C++ programming, because my English is poor and there are many synonyms in English.
Of course there are Boolean names that begins with Is or Can or Has or any other Boolean expression.
What to choose when there are synonym words (ie. Display and Show) !?

Thank you for your understanding

推荐答案

我经常只写一个简短的句子...

示例:
I often just contract a short sentence...

Example:
size_t NumberOfFilesProcessed;



如果我在很长一段时间后回到这段代码,仍然无法确切知道该变量打算代表什么.



If I come back to this code after a long absence, it''s still clear exactly what the variable is intended to represent.


我认为:
  • 您并不孤单(我们中的许多人有同样的问题).
  • displayshow都可以理解(我想有些库使用前者,而其他库使用后者).这是一个典型的场景,因为同义词是同义词...
  • 也就是说,无论如何,精度总是很好,我不会太在意.
I think:
  • You are not alone (many of us have the same problem).
  • Both display and show could make sense (I suppose some libraries use the former while others use the latter). This is a typical scenario, because synonyms are, well, synonyms...
  • That is: precision is always good anyway I wouldn''t bother too much.


Wiki [
Wiki[^] is always helpfull ;)


这篇关于约定:为函数和关键字声明选择最佳的英文名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆