On 13.05.2005, at 14:38, stéphane ducasse wrote:
>> For the refactoring of pages we need to know the (direct) parent of
>> each SW2WikiObject (especially SW2DocumentItem subclasses).
>> SW2WikiObject has the instance variable owner, but it is not always
>> We thought it would may be of general interest to always have this
>> attribute. Would it be possible to get this feature?
> In my opinion, back-links are generally a bad thing and therefor I
> try to avoid them whenever possible. Have a look at the i-var parent
> in SW2Structure and SW2Decoration and all the hassle around this.
> Back-links duplicate information and it makes several things, such as
> copying, more difficlut.
As far as we know, DocumentItem matches a composite pattern. Most
composite patterns do have parent links (e.g. Java AWT and there seems
> Actually, while traversing a composite with a visitor you have given
> all the parent nodes implicilty in the context-stack. I don't suggest
> that you are using the context, but to keep the last node in an i-var
> or build up a stack of the current path to your visited nodes.
I'm not that sure because in a AST having a back pointer can save
a lot of work.
Now the question is if the back pointer changes a lot of not. Because
normally this should not
be difficult to have one single entry point to set it up and remove it.
My experience with AST visitor based walking taught me that I like
We are searching for elements with a visitor, but the refactoring
itself happens independently.
We need the knowledge about the parent of each DocumentItem while doing
the refactoring (e.g. for removing). We can not do the refactoring
with a visitor, because we want to present the search result to the
user for selection. If we have to deal with this without back links, we
need to collect the parents in the search-visitor and keep this
information temporarely in the search result. This would not be nice as
it is not the responsibility of the search result to know the parent of
the found elements.
Daria & Norbert