Monday, March 28, 2011

Documentation is important


/**
* getRows.
* @param inData DataIn
* @param index int
* @return Data
* @throws Exception when something goes wrong
*/
public Data getRows(DataIn inData, int index)

Good to know that an Exception is thrown when something goes wrong.

Tuesday, March 22, 2011

Keep your code readable

Sorry but I still don't get it ....


public void doSomething(Vector items) {
int j = 0;
while (j < items.size()) {
// 50 lines of code
if (0 == j && 1 < items.size()) {
break;
}
// 50 lines of code
j += (j + 1) == items.size() && 1 < items.size() ? -j : 1;
}
}