写代码就像写作文,所以Joshua Bloch在Coder at Work的采访中推荐了一本写作书,The Elements of Style,和 一本词典,Merriam-Webster’s Collegiate Dictionary, 11th Edition。

强烈推荐“Long Names Are Long”这篇文章,可以帮助我们给函数或者变量命名时更加简洁。 下面是文章中给出的一些例子(例子的上下文见文章),

// Bad:
String nameString;
DockableModelessWindow dockableModelessWindow;

// Better:
String name;
DockableModelessWindow window;

// Bad:
List<DateTime> holidayDateList;
Map<Employee, Role> employeeRoleHashMap;

// Better:
List<DateTime> holidays;
Map<Employee, Role> employeeRoles;

// Bad:
mergeTableCells(List<TableCell> cells)
sortEventsUsingComparator(List<Event> events,
	Comparator<Event> comparator)

// Better:
merge(List<TableCell> cells)
sort(List<Event> events, Comparator<Event> comparator)