blob: 1a890c69a36012f77455028b9ffd0ee40fe48103 [file] [log] [blame] [edit]
#summary Considerations when developing and reviewing source code.
= Sweeping guidelines =
# Don't introduce code provisionally. Only insert code that is being used for a purpose. Corollary: Develop using vertical slices, instead of horizontal slices.
# Each CL does one thing. Don't insert refactorings into functional changes and vice-versa.
# Aim for small CLs.
# Don't send out "try-things-out" CLs.
# Make CLs direct and concrete.
* no unneccesary indirection; keep hierarchies shallow
* put String constants directly in code instead of having unnecessary finals declared
# Prefer plain/idiomatic/obvious over clever.
# Name things!
* make specific exception classes
* don't use "abstract" in class name
* don't use "impl" in class name
* name sub-blocks of code by converting to methods
= Particular considerations =
# Is the code thread safe? Read your code and check whether your code behaves well when multiple methods of an instance are executing simultaneously. Avoid settors to make classes immutable.
# Was equals considered?
# Was hashCode considered?
# Were exceptions considered? Are exceptions scoped precisely and accurately?
# Was toString considered? toString is helpful for testing and debugging.
# Does the code call exit? Don't call exit as it makes code un-libifable and means shutdown sequenceing is not understood.
# Please provide sufficient tests.
# BufferedImage is TYPE_INT_RGB
# Gui use done with SwingUtilities.invokeLater () so that SwingUtilities.isEventDispatchThread()
# Usually if a class uses Random, it is parameterizable on Random
# Was use of System.out and System.err considered? Be very selective about putting information on these channels. Quite possibly never use them for communicating information.
# Watch out for autoboxing and varargs producing undesireable behaviour.
# Consider public and final modifiers on classes and methods.
# Add javadoc
= Detailed Google Java guide =
http://google-styleguide.googlecode.com/svn/trunk/javaguide.html