switch (userChoice) {
case 1:
((VO) vo).setAne(new Integer(1));
break;
case 2:
((VO) vo).setAne(new Integer(2));
break;
case 3:
((VO) vo).setAne(new Integer(3));
break;
default:
break;
}
Thursday, March 31, 2011
Tuesday, March 29, 2011
Abstract methods? what is that?
protected void initialize() {
// do nothing here, it will be overridden in the subclasses
}
// do nothing here, it will be overridden in the subclasses
}
Tuesday, February 8, 2011
Thursday, January 27, 2011
We need to go deeper
String infoMessage = getInfoMessage();
screenInfoMessage = new String(infoMessage);
// ...
infoMessage = new String(screenInfoMessage);
screenInfoMessage = new String(infoMessage);
// ...
infoMessage = new String(screenInfoMessage);
Wednesday, January 26, 2011
When in doubt, use a switch
switch (type) {
default:
compositeFactory = new EditorCompositeFactoryImpl(parent, type);
break;
}
default:
compositeFactory = new EditorCompositeFactoryImpl(parent, type);
break;
}
One if statement is not enough
if (compositeMode == DialogMode.UPDATE_MODE) {
hierarchyTabCompositeFactory.setFamily(false);
}
headTabCompositeFactory.bind();
if (compositeMode == DialogMode.UPDATE_MODE) {
hierarchyTabCompositeFactory.setFamily(true);
}
if (compositeMode == DialogMode.UPDATE_MODE) {
hierarchyTabCompositeFactory.bind();
}
hierarchyTabCompositeFactory.setFamily(false);
}
headTabCompositeFactory.bind();
if (compositeMode == DialogMode.UPDATE_MODE) {
hierarchyTabCompositeFactory.setFamily(true);
}
if (compositeMode == DialogMode.UPDATE_MODE) {
hierarchyTabCompositeFactory.bind();
}
Tuesday, January 25, 2011
If not statement
if (article instanceof Article
&& ((Article) article).getArticleCode() == null) {
// NOTHING
} else {
setEnableTitle();
}
&& ((Article) article).getArticleCode() == null) {
// NOTHING
} else {
setEnableTitle();
}
Subscribe to:
Posts (Atom)