当前位置: 代码迷 >> 综合 >> 我的编码风格
  详细解决方案

我的编码风格

热度:67   发布时间:2024-01-20 00:25:08.0

命名规则:
类名称大写
MyClass

变量骆驼命名规则
myVar

常量全部大写
MYCONST

方法名称大写:
MyMethod

接口名,前加一个大写字母I:

IMyInterface

写法:

class MyClass:SomeClass,IMyInterface

先写父类在写接口

代码风格:
缩进用TAB键
if()
{
 //do some here
}  
else
{
 if()
 {
  //do some here
 }
}


注释约定:
方法体前写功能注释
变量后加注释

myVar #标识什么的变量

#the function is
MyMethod()
{
 //do some here
}

变量命名规则:
见名知意
数组前加arr 例如arrCmdExe
字符串前加str 例如strPerlCmdLine
用英文单词标注变量含义,简洁。

缩进能用Tab键,就不用空格


好的编程习惯:
变量定义以前一定要进行初始化


 

  相关解决方案