Eclipse_Java编码规范详细设置

转载请注明来源:http://blog.csdn.net/u010194538/article/details/51167563

软件项目质量保证----编码规范。

一个公司团队有个编码规范是必须的,大部分公司的都一样,但每个不同的公司有一些特殊的要求。

编码规范的作用

提高可读性;有助于知识传递,加快工作交接 ;统一全局,促进团队协作;减少名字增生,降低维护成本;强调变量之间的关系,降低缺陷引人的机会;提高程序员的个人能力

  1. Eclipse开发样式

    这里主要先从Eclipse工具说下:

  1. 设置工作空间的编码格式为UTF-8

    window->preferences->general->workspace->text file encoding->UTF-8

  2. 修改字体样式和大小  Window->Preferences->Appearance->Colrs
    and Fonts->Basic->Text Font->Edit

  3. 修改java编码格式

    Window->Preferences->Java->formatter->New->输入要改为的格式名称->OK

    [built-in]:自带

    new
    可以new自己设置需要的代码格式,选择Eclipse[built-in]

    在这里可以修改各种样式。

    Indentation(缩排)

    General settings(一般设置)

    Tab policy:      1.spaces only:w文件格式自动转换spaces(单独空格)

    2.tab only:文件格式自动转换成tab键

    3.Mixed:混合

    Indentation size:缩进大小

    Tab size:Tab键大小

    Alignment of fields in class declaration:在类的声明里校正

    Align fields in columns:排列对齐

    Indent(缩排)

    1.Declarations within class body:给类的body里缩进

    2.Declarations within enum declaration:枚举里缩进

    3.Declarations within enum constants:枚举里的方法缩进

    4.Declarations within annotation declaration:注释缩进

    5.Statements within method/constructor body:缩进方法体力的构造器

    6.Statements whthin blocks:区段里面的陈述的缩进

    7.Statements whthin‘switch’body:switch方法体内缩进

    8.Statements whthin‘case’body:case里的缩进

    9.‘break’statements:缩进break.

    10.Empty lines:空格排列的缩进

    Braces

    Class or interface declaration     修改接口后的大括号格式

    Anonymous class declaration
    修改实例化操作后的大括号格式

    Constructor declaration  修改构造方法后的大括号格式

    Method declaration
    修改方法后大括号格式

    Enum declaration
    修改枚举大括号格式

    Enum constant body修改枚举常数大括号格式

    Annotation type declaration修改注释类型后大括号格式

    Blocks修改for循环大括号格式

    Blocks in case statement
    修改case后大括号格式

    Switch statement
    修改switch后大括号格式

    Array initializar修改初始化数组大括号格式

    white space(空白)

    Declarations

    Classes

    before opening brace of a class  普通类括号前要不要空格

    before opening brace of an anonymous class  内部类括号前面要不要空格

    before camma in implements clause
    逗号前面要不要空格。

    after comma in implements clause
    逗号后面要不要空格。

    Fields

    befort comma in multiple field declarations  声明一个变量的时候逗号前面要不要空格

    after camma in multiple field declarations   声明一个变量的时候逗号后面要不要空格

    Local variables

    before comma in multiple local declarations  本地类的声明变量的时候逗号前面要不要空格

    after comma in multiple local declarations   本地类的声明变量的时候逗号后面要不要空格

    Constructors

    before opening parenthesis
    方法名字前面的空格

    after opening parenthesis
    括号里面类型前面的空格

    before closing parenthesis
    括号里面声明的末尾要不要空格

    between empty parenthesis
    声明的空的方法里面要不要空格

    befor opening brace [throws]抛出异常末尾要不要空格

    befor comma in parameters方法里面逗号前面是否要空格

    after comma in parameters
    变量与变量之间要不要空格

    before comma in ‘throws‘  clause
    抛出的异常与异常之间的逗号前面要不要空格

    after comma in ‘throws‘ clause  抛出的一次与异常之间的逗号后面要不要空格。

    Methods

    before opening parenthesis
    括号前面要不要空格

    after opening parenthesis
    方法在打开括弧之后的空格

    before closing parenthesis
    方法在关闭括弧之前的空格

    between empty parenthesis方法在空的括弧之间的空格

    before opening brace方法在打开支柱之前 的空格

    before comma in parameters
    在叁数中的逗点前的方法 空格

    after comma in parameters在叁数中的逗点后的方法 空格

    before ellipsis in vararg parameters在vararg叁数中的省略前的方法 空格

    agter ellipsis in vararg parameters在vararg叁数中的方法agter省略空格

    before comma in ‘throws‘ clause逗点前的方法在"丢
    "条款空格

    after comma in ‘throws‘ clause
    逗点后的方法在 " 丢"条款  空格

    Labels//标签

    1:before colon(在冒号之前)

    2:after colon(在冒号之后)

    Annotations//注解

    1:after(在最前往后缩)

    2:before opening parenthesis(在打开括弧之前)

    3:after opening parenthesis(在打开括弧之后)

    4:before comma(在逗点之前)

    5:after comma(在逗点之后)

    6:before closing parenthesis(在关闭括弧之前)

    Enum types      (Enum
    打字)

    before opening brace in declaration   (括号前是空格)

    before comma between constants   (逗号前是空格)

    afte command                                       (逗号后是空格)

    before opening parenthesis in constant arguments   (在打开持续的争论的括号之前空格)

    after  opening parenthesis in constant arguments   (在打开持续的争论的括号之后空格)

    between empty parenthesis in constant arguments    (在空的括号之间空格)

    before comma in constant arguments  (在持续的争论的逗点之前空格)

    after comma in constant arguments  (在持续的争论的逗点之后空格)

    before clsing parenthesis in constant arguments    (在持续的争论的clsing括弧之前空格)

    befor opening brace of constant body               (befor打开持续身体的支柱)

    Annotation types//注解打字

    1:before(以前)

    2:after(在每行得最前)

    3:before opening brace(大括号前单行往后缩)

    4:before opening parenthesis in annotation type members  (在注解类型成员中打开括弧之前)

    5:between parenthesis in annotation type members(在括弧之间在注解类型成员中)

    Control statements

    Blocks:

    before opening brace:大括号之前空格

    after closing breace:
    大括号之后空格

    if else:

    before opening parenthesis:小括号之前空格

    after opening parenthesis:  前小括号后空格

    before closing parenthesis:
    后小括号前空格

    for:

    before opening parenthesis:for后面空格

    after opening parenthesis:前小括号后空格

    before closing parenthesis:  后小括号前空格

    befor comma in initialization :逗号空格

    after comma in initialization:
    逗号后空格

    befor comma in increments :
    加号(增量)前空格

    after comma in increments :加号(曾量)后空格

    befor semicolon:分号前空格

    after semicolon:分号后空格

    befor colon:冒号前空格

    after colon:冒号后空格

    switch:

    befor colon in case : case后空格

    befor colon in default: default(默认)后空格

    befor opening brace:
    大括号前空格

    befor opening parenthesis:小括号前空格

    after opening parenthesis:前小括号后空格

    befor closing parenthesis:后小括号前空格

    throw^-^

    before parenthesized expaessions
    【在throws语句后括号表达式前加空格】

    return

    before parenthesized expaessions
    【在return语句后括号表达式前加空格】

    assert^-^

    before colon                 【在assert语句后面的冒号前加空格】

    assert^-^after colon         【在assert语句后面的冒号后加空格】

    catch

    before opening parenthesis   【在catch语句后面的括号前加空格】

    after opening parenthesis    【在catch语句后面的括号里语句开端加空格】

    closing parenthesis          【在catch语句后面的括号里语句结束的地方加空格】

    try-with-resources

    before opening parenthesis   【在try语句后面的括号前面加空格】

    after opening parenthesis    【在try语句后面的括号里语句开端加空格】

    before semicolon             【在try语句后面的分号前加空格】

    after semicolon              【在try语句后面分号后加空格】

    before closing parenthesis   【在try语句后面的括号里语句结束的地方加空格】

    synchronized^-^

    before opening parenthesis   【在synchronized语句后面的括号前加空格】

    after opening parenthesis    【在synchronized语句后面的括号里语句开端加空格】

    before closing parenthesis
    【在synchronized语句后面的括号里语句结束的地方加空格】

    while-do while^-^

    before opening parenthesis   【在while语句后面的括号前面加空格】

    after opening parenthesis    【在while语句后面的括号里语句开端加空格】

    before closing parenthesis   【在while语句后面的括号里语句结束的地方加空格】

    Expressios(表达式的空格)

    Function  invocations  ()

    before opening parenthesis       (在圆括号之前是否要加空格)

    after opening parenthesis        (在圆括号之后是否要加空格)

    before closing parenthesis        (在圆括号结束时是否要加空格)

    between empty parenthesis      (在圆括号之间是否要加空格)

    before comma in method arguments   (在方法参数逗号前是否要空格)

    after comma in method arguments     (在方法参数逗号后是否要空格)

    before comma in object allocation arguments(在new对象时参数逗号前是否加空格)

    after comma in object allocation aruguments(在new对象时参数逗号后是否加空格)

    before comma in explicit constructor call(在构造方法里的逗号前是否加空格)

    after comma in explicit constructor call(在构造方法里的逗号后是否加空格)

    Assignments ()

    before assignments operator (在任务操作员之前 或翻译成在运算符号之前是否加空格)

    after assignments operator在任务操作员之后 或翻译成在运算符号之后是否加空格();

    Operators ()

    before binary operators (在二进位的操作员之前 或在成对的数据之前)

    after binary operators (在二进位的操作员之后 或在成对的数据之后)

    before unary operators(在一元的操作员之前)

    after unary operators(在一元的操作员之后)

    before prefix operators(在前缀操作员之前)

    after prefix operators(在前缀操作员之后)

    before postfix operators (在词尾操作员之前)

    after postfix operators (在词尾操作员之后)

    parenthesized expressions

    before opening parenthesis (-在打开括弧之前)

    after opening parenthesis (-在打开括弧之后)

    before closing parenthesis (在关闭括弧之前)

    type casts

    after opening parenthesis (-在打开括弧之后)

    before closing parenthesis (-在打开括弧之前)

    after closing parenthesis (在关闭括弧之后; );

    Conditionals

    before  question mark (在问号之前)

    after question mark ()在问号之后

    before colon(在冒号之前)

    after colon (在冒号之后)

    Arrays

    Declarations(数组说明)

    1:before opening bracket(数组前括号往后缩)

    2:between empty brackets(数组前括号的单行后往后缩)

    Allocation(陈列结构)

    1:before opening bracket(数组后括号往后缩)

    2:after opening bracket(数组里标明了行数的往单行前括号后缩)

    3:before closing bracket(数组标明行数的单行后括号往元素后缩)

    4:between empty brackets(数组没有行数的单行后括号往后缩)

    Initializers(数组表)

    1:before opening brace(所有大括号往后缩)

    2:after opening brace(大括号里有元素的,元素往后缩)

    3:before opening brace(大括号里有元素的,后行括号往后缩)

    4:before comma(大括号里有元素的,所有逗号往后缩)

    5:after comma(大括号里有元素的,所有元素往后缩)

    6:between empty braces(空大括号的后行往后缩)

    element access(数组元素后继函数)

    1:before opening bracket(数组括号往后缩)

    2:after opening bracket(数组前单行括号里的下标往后缩)

    3:before closing bracket(数组后单行括号往后缩)

    BlankLines(
    空白的行)

    Before package declaration在包的上面空几行

    After package declaration
    在包的下面空几行

    Before import declaration在import的上面空几行

    Between import declaration在import的之间空几行

    After import declaration在import的下面空几行

    Between class declaration在class的之间空几行

    Before first declaration                         在类嵌套中第一个类上面空几行

    Before declaration of the same kind       在构造方法的上面空几行

    Bwfore member class declaration          在class成员声明之前空几行

    Bwfore field declaration
    在private         成员之前空几行

    Bwfore method declaration                  在方法之前空几行

    At beginning of method body                在方法的第一行代码与方法之间空几行

    Number of empty lines to preserve       在两个注释间空几行

    New Lines(
    新行操作)

    In  empty  class  body           在空类方法体里面大括号之间换行

    In  empty  anonymous  class  body   在空类方法体匿名里面大括号之间换行

    In  empty  method  body         在空方法体里面大括号之间换行

    In  empty  block                             在空循环里面大括号之间换行

    after  labels                                   在循环标志之后大括号之间回撤

    In  empty  enum declaration        在空的枚举里面大括号之间换行

    In  empty  enum  constant  body    在空的枚举方法体里面大括号之间换行

    In  empty  annotation  body           在空的接口里面注释方法

    at  end  of  file                             结束的时候空一行

    Array initializers
    对数组元素的开头和结尾之间是否换行

    Insert new line after opening brace of array initializers  对数组元素开头第一个括号后面是否要换行

    Insert new line before closeing brace of array initializers     对数组元素结尾的括号前面是否要换行

    Empty statements
    空声明的操作

    Put empty statements on new line                              两个空白的语句之间的换行 如:;;

    Annotations
    注释操作

    Insert new line after annotations on packages               在注释包的后面插入一行

    Insert new line after annotations on types                     在注释类的后面插入一行

    Insert new line after annotations on fields                     在注释声明的后面插入一行

    Insert new line after annotations on methos                   在注释方法的后面插入一行

    Insert new line after annotations on parameters             在注释参数的后面插入一行

    Insert new line after annotations on local varliables         在注释局部变量的后面插入一行

    Genearl statements

    一.General

    1.  Insert new line before ‘else‘ in an ‘if‘ statement (插入新的一行之前在“别人的“如果”的声明)else在上一个if括号之后的下一行

    2.Insert new line before ‘catch‘ int a ‘try‘ statement(插入新的一行之前的捕捉的智力“试”的声明)Catch在上一个括号之后的下一行

    3.Insert new line before ‘finally‘ int a ‘try‘ statement(插入新的一行在“终于”智力“试着说‘声明)Finally在上一个括号的下一行

    4.Insert new line before ‘while‘ int a ‘do‘ statement(插入新的一行”而“智力前一个“做”的声明)While在上一个括号的下一行

    二.’if else’

    1.Keep ‘then‘ statement on same line(‘然后‘声明在保持相同的路线)If后面只有一条语句且没带括号时和if放在一行

    (1).Keep simple ‘if‘ on one line(保持简单的“如果”在一行)单个if后面只有一条语句且没带括号时和if放在一行

    2.Keep ‘else‘ statement on same line(保持相同的别人的声明线)单个else后面只有一条语句时和else放在一行

    3.Keep ‘else if‘ on one line(保持“else if ‘一行。)If嵌套时else后的if在else的下一行且缩进

    4.Keep ‘return‘ or ‘throw‘ clause on one line(保持‘回归”或“扔”条款在一行)单个if后面只有一条语句且带括号时和if放在一行

    Line Wrapping

    Maximum line width
    每行容纳的字符个数。

    Default indentation for wrapped lines  大致设置。默认压痕为数组的初始化。

    Default indentation for array initializers lines给排列initializers的假设值压痕排成一行。

    Never join already wrapped lines
    默认压痕包装线。

    Prefer warpping outer expressions(keep nested expression on one line)选择外部表达式的包。

    Annotations  注解 。

    Element-value
    元素-价值。

    Class Declarations
    阶级声明。

    extends clause
    继承子句。

    implements clause
    工具子句。

    constructor declarations
    构造器声明。

    Parameters参数。

    throws clause
    抛子句。

    method declarations  方法声明。

    declaration
    公告。

    parameters
    参数。

    throws clause抛子句。

    enum declaration
    枚举公告。

    Constants常量。

    implements clause工具子句。

    constant arguments
    不变的参数。

    function calls
    函数调用。

    Arguments参数。

    qualified invocations
    合格的祈祷。

    explicit constructor invocations明确的构造器祈祷。

    object allocation arguments
    目标分配参数。

    qualified object allocation arguments合格的目标分配参数。

    expressions
    表达式。

    binary expressions
    二进制的表达式。

    Conditionals有条件的。

    array initializers排列初始化软件。

    Assignments分配。

    statements
    声明

    compact if else使装满如果别的。

    try-with-resources
    试验支持资源。

    multi catch捕捉多个异常。

    Line Wrapping policy换行政策。

    Do not wrap不包。

    Wrap where necessary
    在必要时包装。

    Wrap first element, others where necessary  在必要时包装第一个元素。

    Wrap all elements, every element on a new line包装所有元素,每个元素在一个新的行。

    Wrap all elements, indent all but the first element包装所有元素,但第一个元素缩进。

    Wrap all elements, except first element if not necessary  包装所有元素,如果不是必要的除了第一个元素。

    Indentation  policy :
    缩进方针。

    Default Indentation:
    默认缩进。

    indent on column :
    在列上缩进。

    Indent by column :
    根据列缩进。

    General settings(一般的设定)

    Enable javadoc comment formatting  促使javadoc评论格式

    Enable block comment formatting  促使区段评论格式

    Enable line comment formatting促使线评论格式

    Enable header comment formatting促使首领评论格式

    Preserve white space between code and line comments    在密码之间保护白色空间而且排成一行评论

    Never indent line comments on first column在第一个专栏上不要切割成锯齿状线评论

    Never indent block comments on first column在第一个专栏上不要切割成锯齿状区段评论

    Never join line
    从不接合处排成一行

    javadoc comment settings   javadoc批评设定

    Format HTML tags格式HTML附以签条

    Format java code snippets inside ‘pre‘tags格式新型的计算机语言代码片断在’之内pre‘tags

    Blank line before javadoc tags javadoc前的空白的线附以签条

    Indent javadoc tags
    契约 javadoc 附以签条

    Indent description after @param在切割成锯齿状描述之后@param

    New line after @param tags新线在@之后param附以签条

    /**and*/on separate lines

    /**和*/在分开的线上

    Remove blank lines
    除去空格线

    3  Block comment settings区段评论设定

    /*and*/on separate lines/*和*/在分开的线上

    Remove blank lines除去空格线

    4  Line width线宽度

    Maximum line width for comments:最大线宽度为评论:

    Clean Up

    Code Organizing:编码组织

    formatter:格式化

    remove trailing whitespace:删除行尾部的空格

    all lines:所有的类

    ignore empty lines:不顾其他的类

    correct indentation:正确缩进

    The settings for the formatter can be changed on the formatter preference page:

    给格式化的设定能在格式化上被改变偏爱页

    imports:导入

    organize imports:组织导入

    The settings for organizing imports can be changed on the Orgainze Imports preference page:

    组织进口货的设定能被改变

    members:成员

    sort members:种类成员

    sort all members:

    all:所有

    ignore fields and enum constants:

    ignore:不顾

    fields:田;场所

    and:与

    enum:枚举

    constants:不变的;连续发生的

    Code Style

    control statements(控制语句括号)

    Use blocks in if/while/for/do statements

    Always(总是)

    Always except for single ‘return‘ or ‘throw‘ statements

    (除了return "或" throw "以外"总是加括号)

    only if necessary(只有当如果必需的)

    convert for loops to enhanced

    Expressions(表示式)

    Use parentheses in expressions(表达式使用圆括号)

    Always(总是)

    only if necessary(只有当如果必需的)

    Variable declarations(变量声明)

    Use modifler ‘final‘ where possible(哪里使用修饰语"
    final " )

    private fields(私有的属性)

    parameter(参数属性)   local bariables(局部的变量)

    Member Accesses:
    成员存取

    Non static accesses:
    非静态存取

    Use ‘this‘ qualifier for field accesses:强制性的在属性前添加this.

    Use ‘this‘ qualifier for method accesses:强制性的在方法里取消this.

    Static accesses:静态存取

    Use declaring cass as qualifier:使用宣布cass为给与资格的人

    Qualify field accesses:给属性添加个类名。

    Qualify method accesses:给方法里加上类名。

    Change all accesses through subtypes:在字类里给父类的属性加上类名。

    Change all accesses through instances:使用属性的时候添加方法名。

    Missing Code密码不见的

    Annotations注解

    Add missing Annotations
    增加不见的注解

    ‘@Override‘

    "@ 弃绝"

    Implementations of interface methods (1.6 or higher)  接口方法的落实(1.6或比较高的)

    ‘@Deprecated‘"@
    声明不赞成 "

    Potential programming problems潜能规画问题

    Add serial version ID增加连续的版本身份证

    Generated
    产生

    Default(1L)假设值(1L)

    Unimplemented code不实现密码

    Add unimplemented methods
    增加不实现方法

    The settings for the method stub to insert can be configured on the Code Templates preference page.

    给方法的设定挖除断株插入能在密码型板上被配置偏爱页。

    Missing Code密码不见的

    Annotations注解

    Add missing Annotations
    增加不见的注解

    ‘@Override‘ "@弃绝"

    Implementations of interface methods (1.6 or higher)接口方法的落实(1.6或比较高的)

    ‘@Deprecated‘"@声明不赞成"

    Potential programming problems潜能规画问题

    Add serial versionID增加连续的版本身份证

    Generated  产生

    Default(1L)假设值(1L)

    Unimplemented code不实现密码

    Add unimplemented methods
    增加不实现方法

    The settings for the method stub to insert can be configured on the Code Templates preference page.

    给方法的设定挖除断株插入能在密码型板上被配置偏爱页。

    4、编辑Eclipse的类注释样式

    Window->Java->Code
    Style->Code Templates->Comments->Types->Edit

    然后把注释信息拷贝到Code->New
    Java files->OK。

    ${filecomment}

    ${package_declaration}

    /**

    * @author ${user}

    * @创建时间${date}${time}

    * @描述信息${todo}

    */

    ${typecomment}

    ${type_declaration}





时间: 2024-08-27 12:15:15

Eclipse_Java编码规范详细设置的相关文章

ios之编码规范详细说明

iOS代码规范: 所有代码规范全部遵循苹果sdk的原则,不清楚的请访问苹果SDK文档或下载官方Demo查看. 1.工程部分: 将项目中每个功能模块对应的源文件放入同一文件夹下,使用虚拟文件夹. 引用的.a和相关的文件,独立使用文件夹存放,并标明是SDK 2.类: 命名:首字母大写,其后每个单词首字母大写,类文件的名字必须与类中主要的@interface类名字一致.(例:RootViewController,PersonInfo) category和protocol可以放在独立文件中,或放在某个类

编码规范系列(一):Eclipse Code Templates设置

http://chenzhou123520.iteye.com/blog/1625629 从工作开始,经历了几个项目的开发,现在的项目一般都是一个团队共同开发,而每个人都有自己的编码习惯,为了统一格式,项目组在项目开发之前都会制定一系列的规范.俗话说约定优于配置,但是在执行过程中往往发现效果不是很好(主要是指编码规范这一方面).所以我们不得不采取一些措施来协助我们统一项目开发人员的编码风格.主要包括三个方面:设置Code Templates.Eclipse formatter.Checkstyl

编码规范:Eclipse Code Templates设置

现在的项目一般都是一个团队共同开发,而每个人都有自己的编码习惯,为了统一格式,项目组在项目开发之前都会制定一系列的规范.设置Code Templates的目的主要是为了统一各种注释的格式以及代码的模板,只要设定好Code Templates之后利用Eclipse就可以方便地生成我们自定义的注释,所以我们不得不采取一些措施来协助我们统一项目开发人员的编码风格.主要包括三个方面:设置Code Templates.Eclipse formatter,本篇主要介绍如何设置Code Templates,具

ES6(ECMAScript 2015) 编码规范与详细注意要点

ES6(ECMAScript 2015) 编码规范与详细注意要点,结合广发证券大量ES6实践项目整理而成, 已开源于Github中,持续更新中,欢迎PR以及提issue. Github地址:https://github.com/gf-web/es6-coding-style/ 本规范是基于JavaScript规范拟定的,只针对ES6相关内容进行约定 如变量命名,是否加分号等约定的请参考JavaScript规范 应注意目前的代码转换工具(如Babel,traceur)不够完善,有些特性须谨慎使用

java04eclipse常见设置和java的第一个程序、命名规范、编码规范

一.java的第一个程序 *所有的java程序是写在.java为后缀的文本 *所有的java程序一定是写在class中   即写在类里面的 *所有的java程序的入口一定是main方法 *写代码 二.新建一个java项目 <1>新建一个java工程 <2>在src下建包 <3>在包下面新建java文件 <4>所有java代码是在写类里面的 <5>hello word  运行 <6>命名规范 *标识符:类名.包名.方法的名字,首字母.$

web项目开发 之 前端规范 --- JavaScript编码规范

JavaScript编码规范 此文严格按照W3C规范和部分实际项目可读性,浏览器加载,性能等众多属性权衡,做出平时前端编码规范文档.供广大web工作者参考并实施,对维护和项目扩展升级都能省时省力. 场景:web前端开发中 一些Javascript的注意事项 和 规格建议: [参考百度资料 和个人一些总结] 1 前言 JavaScript 在百度一直有着广泛的应用,特别是在浏览器端的行为管理.本文档的目标是使 JavaScript 代码风格保持一致,容易被理解和被维护. 虽然本文档是针对 Java

[转载]Objective-C开发编码规范:4大方面解决开发中的规范性问题

Objective-C 编码规范,内容来自苹果.谷歌的文档翻译,自己的编码经验和对其它资料的总结. 概要 Objective-C 是一门面向对象的动态编程语言,主要用于编写 iOS 和 Mac 应用程序.关于 Objective-C 的编码规范,苹果和谷歌都已经有很好的总结: Apple Coding Guidelines for Cocoa Google Objective-C Style Guide 本文主要整合了对上述文档的翻译.作者自己的编程经验和其他的相关资料,为公司总结出一份通用的编

android编码规范

一.Android 编码规范 1.java 代码中不出现中文,最多注释中可以出现中文 2.局部变量命名.静态成员变量命名 只能包含字母,单词首字母出第一个外,都为大写,其他字母都为小写 3.常量命名 只能包含字母和_,字母全部大写,单词之间用_隔开 4.layout中的id命名 命名模式为:view缩写_模块名称_view的逻辑名称 view的缩写详情如下 LayoutView:lv RelativeView:rv TextView:tv ImageView:iv ImageButton:im

《疯狂Java讲义(第3版)》.(李刚)——java命名规则及编码规范

1.命名规则: 此处借鉴一下他人的资料,比较全面一些,方便了解学习. JAVA源文件的命名 JAVA源文件名必须和源文件中所定义的类的类名相同. Package的命名 Package名的第一部分应是小写ASCII字符,并且是顶级域名之一,通常是com.edu.gov.mil.net.org或由ISO标准3166.1981定义的国家唯一标志码.Package名的后续部分由各组织内部命名规则决定,内部命名规则指定了各组件的目录名,所属部门名.项目名等. Class/Interface的命名 Clas