This question is partially for the JVM gurus, and partially for anyone
interested in performance vs. clarity issues.

All of our data structures either are or should be tree structures. We have
an FO Tree and an Area Tree, and the control structures can tie them
together into one tree as well, so that everything is in a hierarchy. One
benefit of this is that we have potential to eliminate the amount of
parameters that must be passed around, which I think will be a good thing
from a clarity standpoint. We could, for example, create the following in
fo.FONode:

    public PageSequence getPageSequence() {
        return this.parent.getPageSequence();
    }

which could then be overridden in fo.pagination.PageSequence with:

    public FONode getParent() {
        return this;
    }

This means that if you have an object from the FO Tree, you can easily find
out which PageSequence it is associated with.

A similar thing could be done to obtain the soon-to-be-created Document
object (which is either a parent or a grandparent of the PageSequence,
depending on implementation decisions), which in turn can contain the Logger
object, and will contain information about what fonts have been used, etc.
This means that none of this information has to be carried around, but can
be obtained on-the-fly as needed. If later we decide to allow multiple
documents to be processed in a Session, the Session ties the Documents
together, and the Session can be reached from the Document (which will point
to it). In other words, virtually every data object that we have has a
parent, and should know who that parent is. Similar things can be done in
the Area tree also, I think. While this makes life nice from a programming
standpoint, and I think will help a lot in simplifying our code, I want to
make sure that it doesn't create an unacceptable performance hit. So, if you
are 12 levels deep in an FO Tree, you would have to go up 12 levels to get
the answer, then return through the 12 levels to get the answer delivered.

Another thing to consider is that even if we didn't want to use this scheme
forever, it might help us get the code untangled in the short term, and then
we would want to use parameters more, perhaps in some judiciously-chosen
profiler-signalled places only. What are your thoughts on this?

Victor Mote


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to