Open eclipse-viatra-bot opened 6 months ago
By Zoltan Ujhelyi on Mar 18, 2020 06:41
Thanks for the feedback, I am planning to do a similar thing to the transformation tutorial we have already done for the query tutorial [1]: convert it to a project that is part of our main build and make sure the tutorial extracts the relevant elements from there, but so far I did not have the time to do it.
In the meantime, can you share with us what steps were not clean enough for you? It is possible that adding an extra sentence or a screenshot could help a lot.
By Hans van der Laan on Mar 18, 2020 08:16
Sure. The points which were unclear are:
In 4.1:\ "Constructor will also initialize transformation (replace the generated one) It assumes that the output and trace models are already created"
How are they normally created? What do they contain? I do not have access to the source in the tutorial. (when I try to inspect the class, I get: "The source attachement does not contain the source for the file DeploymentPackage.class")
I'm unsure if I pasted the rules of 4.1 in the correct place (hostrule, applicationrule). If place them on class-level, I get the error "“Java problem: The blank final field cps2dep may not have been Initialized”.
I overlooked the message that DeploymentHost could be imported automatically.
In 4.2:\ The rule\ val hostRule = createRule(HostInstanceMatcher.querySpecification) \ is incorrect. HostInstanceMatcher should be HostInstance.Matcher
Also, when we add the update action, the line\
val depHost = engine.cps2depTrace.getOneArbitraryMatch(cps2dep, null, hostInstance, null).depElement as DeploymentHost \
seems to be incorrect. I get an error that "The method or field depElement is undefined for the type Optional
When we add the delete action, the methods\ "traceMatch.depElement" and "traceMatch.trace" are also undefined. \ Here I'm again not sure how to solve it.
Lastly, I find it very troublesome to get the eclipse plug-ins working. When I did the tutorial a while ago, I got it to work. However, when I freshly installed eclipse and followed the tutorials again I couldn't get it to work. It would be very helpful if we have a working example which we can just clone. This could be used as a starting point or as a reference point to debug the eclipse configurations.
By Hans van der Laan on Mar 18, 2020 08:20
(PS: I did get the plug-in to work again later. Not sure what I did wrong/changed. Again I just freshly installed Eclipse and followed all the steps again)
By Zoltan Ujhelyi on Mar 18, 2020 10:11
(In reply to Hans van der Laan from comment #2)\ Thanks again for the feedback, it is really helpful, and I will update the tutorial based on them when I will have some time; and yes, we should make the results available. Another thing we might want to think about to replace Xtend with plain Java code, as it would remove one place of uncertainty from the uses (e.g. that would make it more explicit what is connected to which part).
Regardless, your idea we should make the finished project available would also help a lot, so we should solve that as well.
For your localized remarks, I added my answers inline.
Sure. The points which were unclear are:
In 4.1: "Constructor will also initialize transformation (replace the generated one) It assumes that the output and trace models are already created"
How are they normally created? What do they contain?
Fair point, we need to expand this point.
I do not have access to the source in the tutorial. (when I try to inspect the > class, I get: "The source attachment does not contain the source for the file DeploymentPackage.class")
That is strange - the metamodel feature should have installed the sources as well...
I'm unsure if I pasted the rules of 4.1 in the correct place (hostrule, applicationrule). If I place them on class-level, I get the error "Java problem: The blank final field cps2dep may not have been Initialized”.
This is an Xtend-related issue - when some types are not explicitly declared, it might be hard to figure out what might be the case.\
I overlooked the message that DeploymentHost could be imported automatically.
To be honest, I don't understand what this comment means, but if it means a missing java class import that could cause some hard to debug issues in Xtend.
In 4.2: The rule val hostRule = createRule(HostInstanceMatcher.querySpecification) is incorrect. HostInstanceMatcher should be HostInstance.Matcher
Yeah, this refers to the old (pre-2.0 style) file naming convention... This needs to be fixed, good catch.
Also, when we add the update action, the line val depHost = engine.cps2depTrace.getOneArbitraryMatch(cps2dep, null, hostInstance, null).depElement as DeploymentHost seems to be incorrect. I get an error that "The method or field depElement is undefined for the type Optional
". I'm not sure how to solve this.
Again, this was written with a pre-2.0 style API - before 2.0 getOneArbitraryMatch returned a match or null if no match was found; after 2.0 the method never returns null but an Optional
val depHost = engine.cps2depTrace.getOneArbitraryMatch(cps2dep, null,\ hostInstance, null).get.depElement as DeploymentHost
or if you want to have nulls you could write
val depHost = engine.cps2depTrace.getOneArbitraryMatch(cps2dep, null,\ hostInstance, null).map[depElement].orElse(null) as DeploymentHost
When we add the delete action, the methods "traceMatch.depElement" and "traceMatch.trace" are also undefined. Here I'm again not sure how to solve it.
Here we also have an Optional
Lastly, I find it very troublesome to get the eclipse plug-ins working. When I did the tutorial a while ago, I got it to work. However, when I freshly installed eclipse and followed the tutorials again I couldn't get it to work. It would be very helpful if we have a working example which we can just clone. This could be used as a starting point or as a reference point to debug the eclipse configurations.
I can relate to that. This is a point where we had a lot of discussions what should we expect from the potential users of VIATRA, and the extension-based transformation registration is really a bit overkill (as we don't want to provide an extensive plugin development tutorial as well). The main reason we kept this plug-in based architecture was that allows us to illustrate the behaviour of the event-driven transformations with manual model edits in the user interface of the model editor.
By Hans van der Laan on Mar 19, 2020 09:23
Another thing we might want to think about to replace Xtend with plain Java code, as it would remove one place of uncertainty from the uses (e.g. that would make it more explicit what is connected to which part).
This is something I would have preferred.
By Hans van der Laan on Mar 19, 2020 09:34
PS: This is because autocomplete works better in Java, which in turn allows me to discover and analyze functionality easier.
Take for example the code snippet below:
private def getExampleRule() {\ val exampleRule = createRule(ExampleQuery.instance).action[\ val example = it\ ].build\ return exampleRule\ }
Here, you can not see which methods are available to be called on 'it'. Autocomplete doesn't give any suggestions. The only feedback you get is a warning message when you write a undefined method. I found out which methods are available by exploring the generated Java Code.
By Zoltan Ujhelyi on Mar 19, 2020 09:48
(In reply to Hans van der Laan from comment #6)
PS: This is because autocomplete works better in Java, which in turn allows me to discover and analyze functionality easier.
Take for example the code snippet below:
private def getExampleRule() { val exampleRule = createRule(ExampleQuery.instance).action[ val example = it ].build return exampleRule }
Here, you can not see which methods are available to be called on 'it'. Autocomplete doesn't give any suggestions. The only feedback you get is a warning message when you write a undefined method. I found out which methods are available by exploring the generated Java Code.
I can relate to that as well. I cannot promise you we will have time to rewrite the entire tutorial not to rely on Xtend promptly, but I will find the time to fix the other issues you have identified before the next release.
Thanks again for taking the time to report these issues as they are quite embarrassing mistakes and makes VIATRA harder to learn than it should be.
By Hans van der Laan on Mar 19, 2020 11:40
To be honest, your forum and issue tracker activities makes this one of the best open-source projects I’ve worked with. I’m glad I can help :)
| --- | --- | | Bugzilla Link | 561210 | | Status | UNCONFIRMED | | Importance | P3 normal | | Reported | Mar 18, 2020 06:33 EDT | | Modified | Dec 07, 2020 12:55 EDT | | Reporter | Hans van der Laan |
Description
Hey,
I'm working my way through the transformations tutorial. The tutorial does not show the end result, i.e. the final contents of the VQL/Java/etc. files.
This is unfortunate since certain steps are not as clear as others. As far as I could find, it seems the transformation tutorial examples are not added to the example repository. It would be helpful if they were added. If added, when somebody doesn't understand a step, he/she could just look up the end result and work back from there.
Kind regards,
Hans