Typographical naming conventions

Identifier Type

Type Examples

Package

com.google.inject, org.joda.time.format

Class or Interface

Timer, FutureTask, LinkedHashMap, HttpServlet

Method or Field

remove, ensureCapacity, getCrc

Constant Field

MIN_VALUE, NEGATIVE_INFINITY

Local Variable

i, xref, houseNumber

Type Parameter

T, E, K, V, X, T1, T2

Grammatical conventions

Identifier Type

Type Examples

Package

no rules

Class or Interface

Timer, BufferedWriter, or ChessPiece.

Collection or Comparator. Runnable, Iterable, or Accessible.

BindingAnnotation, Inject, ImplementedBy, or Singleton

Method

append or drawImage

isDigit, isProbablePrime, isEmpty, isEnabled,

or hasSiblings.

size, hashCode, or getTime

toType(toString, toArray) asType(asList) typeValue(intValue), static factories(valueOf, of, getInstance, newInstance, getType, newType)

Field

initialized, composite, height, digits, or bodyStyle

Constant Field

MIN_VALUE, NEGATIVE_INFINITY

Local Variable

i, xref, houseNumber

Type Parameter

T, E, K, V, X, T1, T2

Summary

Internalize the standard naming conventions and learn to use them as second nature. The typographical conventions are straightforward and largely unambiguous; the grammatical conventions are more complex and looser. To quote from The Java Language Specification [JLS, 6.8], "These conventions should not be followed slavishly if long-held conventional usage dictates otherwise." Use common sense.

Effective Java 56 Adhere to generally accepted naming conventions的更多相关文章

  1. Effective Java Index

    Hi guys, I am happy to tell you that I am moving to the open source world. And Java is the 1st langu ...

  2. 《Effective Java》读书笔记 - 8.通用编程

    Chapter 8 General Programming Item 45: Minimize the scope of local variables local variables应该在他们要被用 ...

  3. Effective Java 目录

    <Effective Java>目录摘抄. 我知道这看起来很糟糕.当下,自己缺少实际操作,只能暂时摘抄下目录.随着,实践的增多,慢慢填充更多的示例. Chapter 2 Creating ...

  4. 【Effective Java】阅读

    Java写了很多年,很惭愧,直到最近才读了这本经典之作<Effective Java>,按自己的理解总结下,有些可能还不够深刻 一.Creating and Destroying Obje ...

  5. [Effective Java]第八章 通用程序设计

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...

  6. Effective Java通俗理解(下)

    Effective Java通俗理解(上) 第31条:用实例域代替序数 枚举类型有一个ordinal方法,它范围该常量的序数从0开始,不建议使用这个方法,因为这不能很好地对枚举进行维护,正确应该是利用 ...

  7. 《Effective Java(中文第二版)》【PDF】下载

    <Effective Java(中文第二版)>[PDF]下载链接: https://u253469.pipipan.com/fs/253469-230382186 Java(中文第二版)& ...

  8. Effective Java 第三版——39. 注解优于命名模式

    Tips <Effective Java, Third Edition>一书英文版已经出版,这本书的第二版想必很多人都读过,号称Java四大名著之一,不过第二版2009年出版,到现在已经将 ...

  9. 如何创建和销毁对象(Effective Java 第二章)

    最近有在看Effective Java,特此记录下自己所体会到的东西,写篇博文会更加的加深印象,如有理解有误的地方,希望不吝赐教. 这章主题主要是介绍:何时以及如何创建对象,何时以及如何避免创建对象, ...

随机推荐

  1. MySQL中的账号与权限管理

    MySQL权限管理 权限系统的工作原理     MySQL权限系统通过下面两个阶段进行认证:     (1)对连接的用户进行身份认证,合法的用户通过认证.不合法的用户拒绝连接.     (2)对通过认 ...

  2. NuGet 让你都美好的PM

    题外话 从前有座山,山上有座庙,庙里有个老和尚.阿阿阿,好多鱼好多余. 什么是Nuget NuGet(发音:New-Get)是一个Visual Studio的扩展.在使用Visual Studio开发 ...

  3. [C#高级编程].NET体系结构

    本章内容: 编译和运行面向 .NET的代码 MSIL的优点 值类型和引用类型 数据类型化 理解错误处理和特性 程序集..NET基类和命名空间 本章主要介绍一些概念,内容不多. C#是专门为Micros ...

  4. 区间合并 --- Codeforces 558D : Gess Your Way Out ! II

    D. Guess Your Way Out! II Problem's Link: http://codeforces.com/problemset/problem/558/D Mean: 一棵满二叉 ...

  5. Python入门笔记(25):Python面向对象(2)

    一.类 类就是一个数据结构,封装了数据和操作. 类的声明与函数的声明十分类似: class newClass(object): """class documentatio ...

  6. bootstrap学习笔记(6)

    滚动监听        滚动监听有两种方式:        (1)通过属性控制        向想要滚动监听的元素添加如下属性data-spy="scroll",然后添加data- ...

  7. 【jQuery基础学习】08 编写自定义jQuery插件

    目的:虽然jQuery各种各样的功能已经很完善了,但是我们还是要学会自己去编写插件.这样我们可以去封装一些项目中经常用到的专属的代码,以便后期维护和提高开发效率. jQuery插件的类型: 封装对象方 ...

  8. 重新想象 Windows 8.1 Store Apps (82) - 绑定: DataContextChanged, TargetNullValue, FallbackValue, UpdateSourceTrigger

    [源码下载] 重新想象 Windows 8.1 Store Apps (82) - 绑定: DataContextChanged, TargetNullValue, FallbackValue, Up ...

  9. 与众不同 windows phone (49) - 8.1 新增控件: 概述, ContentDialog, MapControl

    [源码下载] 与众不同 windows phone (49) - 8.1 新增控件: 概述, ContentDialog, MapControl 作者:webabcd 介绍与众不同 windows p ...

  10. 返璞归真 asp.net mvc (13) - asp.net mvc 5.0 新特性

    [索引页][源码下载] 返璞归真 asp.net mvc (13) - asp.net mvc 5.0 新特性 作者:webabcd 介绍asp.net mvc 之 asp.net mvc 5.0 新 ...