You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ws.apache.org by Apache Wiki <wi...@apache.org> on 2005/12/10 19:43:19 UTC
[Ws Wiki] Update of "FrontPage/Axis2/CodeQuality" by PaulFremantle
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Ws Wiki" for change notification.
The following page has been changed by PaulFremantle:
http://wiki.apache.org/ws/FrontPage/Axis2/CodeQuality
New page:
=== Code Quality Principles ===
* No spelling mistakes
- Use correct (British) English spelling
* Comment code
- use block comments at the start of the class and before each method
- try to think about what's obvious and what isn't obvious e.g.
{{{
/*
** Gets the Foo property
** [This comment is completely useless unless I've never read ANY Java before]
*/
public Foo getFoo();
/*
** The Foo property is used to decide which foobar to use
** [This comment is trying to say something more than obvious]
*/
public void setFoo(Foo foo);
}}}
- Leave a blank line before the block comment
- Don't put author information in code.
- If you think people will need to contact you about the code it means you haven't put in enough doc :-)
- Clear JavaDoc comments for each method and class
- Interfaces in particular should have clear comments for each method
- If you can't explain the class or method, maybe you need to refactor
* No warnings or errors in Eclipse/IDEA
- There should be no import package.*
- There should be no imports that aren't used
- There should be no unused local variables
- Serializable classes need serialVersionUIDs
- Or better still remove java.io.Serializable unless we are actually using it
- Don't use static methods on instances (use the class not the object)
* Don't use long lines (e.g. greater than 70 characters)
* Aim to initialize variables where they are defined
* Use curly braces on if, while statements
- dont use the shortcut if (something) a; else b;
* If the name of an class or method isn't clear rename it
- if in doubt ask one or two other people
* Always comment decisions you made or didn't make
- If you chose one of two options explain why
- If you failed to do something add a comment {{{// TODO}}} or {{{// FIXME}}} to let other committers know
-