Hello all,
I just took a more extended look at CVS HEAD. There are
some style issues which caught my eye.
1. I'd appreciate if indentation uses spaces instead of
tabs. And because I can avoid using tabs, I expect
everyone else avoiding tabs too.
2. I'd really, really appreciate if assignments were
not made operands of other expressions, especially
not operands of comparisions in if statements:
if ((bp = getNextBreakPoss(childLC, null)) != null) {
I'd make some exceptions for more commonly used idioms
in while statements
while ((curLM = getChildLM()) != null) {
but IMO this still s*cks.
3. Exceptions should never, ever replace simpler flow
controls:
try {
return super.nextChar();
}
catch (NoSuchElementException e) {
if (bEndBoundary) {
bEndBoundary=false;
return CharUtilities.CODE_EOT;
}
else throw e;
}
Apart from the potential for confusion, throwing
exceptions is an expensive operation and should really
be reserved for rare and non-local exits. (In the
particular case above, the discrepancy between hasNext()
and getNext() seems to indicate a design bug that should
be fixed rather than worked around).
Well, Excalibur has some even worse examples of abusing
exceptions, but I don't think this should be followed.
4. Some identifiers make me a bit uneasy, like "BreakPoss".
IMO random abbreviations should be avoided unless the
identifiers become really long and unwieldy, at least
in class names and preferably also in method names.
Furthermore, I think abbreviations should be used
consistently at least across class and method names:
public void setStructHandler(StructureHandler sh) {
public BreakPoss getBP() {
protected Position getPos(Object nextObj) {
Is it really worth to save a few characters this way?
Also, capitalization should be consistent:
class LMiter
interface BPLayoutManager
5. I don't think naming styles should be mixed without good
(and preferably explained) reason:
boolean m_bInited = false;
Yuck!
6. There seems to be a drive to use hungarian notation.
While I don't have a strong feelings for or against it,
I'd like to note that in all projects I've watched such
an efford was ultimately wasted. Usage universally
degraded over time, and causal and inconsistent usage
just makes the code look ugly.
7. I think a bit more time should be spent to check general
consistency after wholesale copy&paste:
/**
* This is the top level layout manager.
* It is created by the PageSequence FO.
*/
public FlowLayoutManager(FObj fobj) {
Well, bad things happen.
It would be nice to get some agreements nailed down and
published.
J.Pietschmann
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]