一个好的程序员写出来的程序应该是1/3的代码,2/3的注释。
下面贴一个标准的程序注释示范:
功能,参数说明一定要有
/**
* Moves the object from the old position to the new position.
* @param list
* @param targetIndex the position of the object after the move.
* @param sourceIndex the position of the object before the move.
* @return the moved object
*/
public static <T> T move(List<T> list, int targetIndex, int sourceIndex)
{
if (list instanceof EList)
{
return ((EList<T>)list).move(targetIndex, sourceIndex);
}
else
{
T object = list.remove(sourceIndex);
list.add(targetIndex, object);
return object;
}
}