A*g 发帖数: 102 | 1 【 以下文字转载自 Linux 讨论区 】
发信人: Ang (拖拉A梦), 信区: Linux
标 题: 大家programming时怎么命名?
发信站: BBS 未名空间站 (Tue Jun 24 18:50:19 2008), 转信
怎样命名variable, function, class, filename ... |
c***r 发帖数: 4631 | 2 float fCurrentPosZMotor = 0.0f; |
t****e 发帖数: 69 | 3 Hungarian notation is not considered a good practice now.
Better use
float currentZPositionOfMotor = 0.0;
【在 c***r 的大作中提到】 : float fCurrentPosZMotor = 0.0f;
|
k**f 发帖数: 372 | 4 There are many naming conventions. The Java convention is a popular one.
Check it out at:
http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html |
r*********r 发帖数: 3195 | 5 i still like the traditional C way of naming: using underscore, like cur_z.
some of the java code has insanely long variable name, like
hasNoSpecialMeaningSadVariable . lol |
d*******8 发帖数: 3182 | 6 variable:类型小写在前,like: strProductName
function: 动词小写在前,like: getProductName
class:名次大写,like: ProductObject
filename: 差不多和class 一样吧。 |
f*******y 发帖数: 988 | 7 每个语言,甚至每个公司和project都不一样的convention的
【在 A*g 的大作中提到】 : 【 以下文字转载自 Linux 讨论区 】 : 发信人: Ang (拖拉A梦), 信区: Linux : 标 题: 大家programming时怎么命名? : 发信站: BBS 未名空间站 (Tue Jun 24 18:50:19 2008), 转信 : 怎样命名variable, function, class, filename ...
|
g*****g 发帖数: 34805 | 8 It's all about consistency, so far, I'd say Sun did a good job on
java convention. C++ style can be very different. Java, you can almost
figure out how well one's trained by looking at the namings.
【在 f*******y 的大作中提到】 : 每个语言,甚至每个公司和project都不一样的convention的
|
f*******y 发帖数: 988 | 9 java这个rule是sun的官方版本吧
【在 g*****g 的大作中提到】 : It's all about consistency, so far, I'd say Sun did a good job on : java convention. C++ style can be very different. Java, you can almost : figure out how well one's trained by looking at the namings.
|
f*****Q 发帖数: 1912 | 10 为什么涅?
【在 t****e 的大作中提到】 : Hungarian notation is not considered a good practice now. : Better use : float currentZPositionOfMotor = 0.0;
|
f*****Q 发帖数: 1912 | 11 俺记着OS X里面都用NS开头表示NeXTSTEP。
Mozilla也用NS开头表示Netscape。 |
t****e 发帖数: 69 | 12 As an example, suppose later you decide to change the variable type from "fl
oat" to "double," then you'll have to change the variable name in every loc
ation, otherwise it will give false information.
【在 f*****Q 的大作中提到】 : 为什么涅?
|