-
Notifications
You must be signed in to change notification settings - Fork 14
refactoring of names for visitor stuff to domain oriented names #34
Conversation
User method overriding is perfectly fine in Java, but can not be used in Ruby or JavaScript. This means we will have different names for the same method in different languages :( Is this what we want? |
We have different names anyway. |
Also I think |
And lastly, I don't think we should cripple the Java code base, because dynamic language can't override functions. We should use the features of the language we work with. Java is a statically typed language; and so should be used as such and the languages features should be used correctly. IMO. |
I agree that mapping "walk" to "walk_var"/"walk_or" is rather intuitive. Are you going to change names for other languages? |
I did. Its in the commit. |
Oops, (to long don't read :( |
I don't really understand the value of this rename. If the AST were actually walking the visitor around the tree (the way it does in the current version of Cucumber) I think that this new method name would help make the code more understandable, but all we're currently asking the nodes to do is use double-dispatch to describe themselves to the caller. I disagree that I'm ambivalent about whether or not to use overrides in Java, but I think @aslakhellesoy already made the point in #12 that it helps if we try to make the shape of the code consistent between the different languages as much as possible. |
I am not ambivalent about using overrides in Java. I do not think that effects the shape. |
@mattwynne hmmm. Let me try explain this another way. Lets say we were using the Visitor pattern twice; for our abstract tree. If we use the current approach of just calling the Essentially the In summary the Thoughts? |
I appreciate everyone's desire and effort to come up with good names. In this case, Let's just revert to the GoF terminology. It's well-documented and it's what most people are used to. Having thought about it I don't think domain-specificness is particularly useful or important here. It's more important that we use terminology people can recognise in pattern literature. Pseudo code:
Is that so terrible? |
No its not terrible at all. What about Java method overloading. I would prefer having just a It does not seem to effect the code shape to me? |
Since we cannot agree on a different naming, I believe that we should use the classic Visitor as described in the GoF book. As long as we are using the same class name, I think that we should use overloading when possible. Ruby developers would read a familiar class not using overloading, Java developers would feel comfortable with the same method name. |
Well, I think it's a shame, because my comments in #32 still stand. Using the pattern name, especially in the method and type names, just feels like hungarian notation to me. But I agree, there's no point in bickering about it. Let's wait until we have some real code in Gherkin: it's too easy to get into bike-shedding with this toy example. |
I have refactored the visitor names as per discussion that happened in #32
Essentially I have tried to replace the standard visitor nomenclature used for showing how visitors work with domain related naming that shows how the visitor pattern is being applied in the code.