From: Sven R. <rei...@ma...> - 2002-12-14 18:01:50
|
On Fri, 13 Dec 2002, Andre Baresel wrote: > I started getting into the sources, but I'm still not usefull for the > project :-( Take your time :) > i think it will take some time to get all the ideas. However I started > to play arround with > this Mutator concept and tried to implement this ToDo Item "Adding a > variable declaration in > if/while statement" ... not to make this for the public, but this is > something I can check against > later on, when you Baptiste have checked your sources in. > > I got something working, but well, I'm not sure if this is ok and > there's a question: > The introduction of a new nodetype for the conditions makes some of the > tests failing, so how is this situation > handled ? Is it ok than to change the tests, too - since the assertion > only reports the new ast-node-type not > beeing expected. Two things: 1) I'm not sure if you need a new nodetype for this situation; we have a type for variable definitions, which can just be plugged into the condition of the if statement. 2) In order not to break existing tests, don't include the new mutator into the MaxLODMutator. Then most tests won't know about your addition, and pass as before. I would wait changing the existing tests until you better understand the whole structure. (You said yourself that you're still working on that.) > > Another thing is the MaxLODMutator ... In the beginning I stumbled > accross two things: > - the methods "mutate" and "doMutate" sound like the same action and > take the same parameters but they > do completely different things ... I would suggest some better naming > here ... maybe doMutate is just "doMultipleMutate" ? I agree that here the code needs to be cleaned up a bit. The two methods do different things, both useful. "mutate" can be applied to any node and will change the whole subtree rooted at that node. It calls "doMutate" for every subnode it encounters, and that method does the actual work. Maybe we'll rename it to "mutateTree" and "mutateNode"? We wanted to separate the recursion from what is done to each node. That what the Visitor class (and its subclasses) are for. The basic reason is that if we were to change the implementation of the AST, we would only need to adapt the Visitor classes, and not every single method that works recursively. > - this MaxLODMutatorVisitor, what about that class, is this really needed ? > As I understand this class is only used to be instanciated in each > recursion of the mutation operation. > Is there anything I can't see ? The use of this class confused me > a little bit. With this class the recursion comes > Invisible for a person reading the source.... Just my opinion. And that's the idea! If someone wants to change a tree, they don't need to know how this change is performed. In the long run, we hope to move more functionality from the subclasses up to the Visitor class itself. > See you later, > Andre Bis die Tage, Sven. -- Sven Reichard Dept. of Math. Sci. University of Delaware rei...@ma... |