Thanks. I didn't know there is a separate group. I've posted it there now:

https://groups.google.com/forum/?#!topic/singular-contrib/JioCFWkhEIQ

Marcin

On Fri, May 15, 2015 at 12:23 AM, Guillaume Rebesche
<[email protected]> wrote:
> This post probably belong to singular-contrib
>
> As far as I can see, Singular will use Annotation processing to generate an
> observable model. So, generated code will be available at compile time (thus
> right away).
>
> cheers,
> Guillaume
>
>
> Le jeudi 14 mai 2015 08:50:44 UTC-4, Marcin Okraszewski a écrit :
>>
>> Hi,
>> I know Singular is in a prototype state, but I’m wondering about one
>> thing. The definition of the model is done using fields. But then the
>> controller is using a class which is apparently generated during GWT build
>> and is providing access via getters and setters instead of fields.
>>
>> I think it is introducing some problems, mostly due to no link between the
>> declared model and generated model.
>>
>> Firstly, you cannot use the model until GWT generates it. It is very well
>> visible on the GWT.create presentation, where there are errors in the
>> workspace until the compilation finishes; and there are generated sources
>> added to project source paths. This also applies to any changes to the
>> model, like adding a field.
>>
>> Secondly, refactoring is a problem. IDE refactor tools won’t see
>> connection between fields in declared model and those in generated class.
>> So, every time you change model (rename a field), you will need to manually
>> change all usages of the corresponding access methods.
>>
>> Solution
>> My suggestion would be that the model is declared as an interface with
>> setters and getters. Then the GWT generates implementation of that interface
>> and this is injected into the controller. But controllers just works with
>> the declared model interface and knows nothing about generated objects.
>>
>> Obviously, the declared model is less readable this way (will there be
>> properties in Java some day?), but the advantage is that there are proper
>> references between model and its usage, so that tools can see usages
>> properly. Also, the whole code is self-contained and error-free even without
>> the generated classes. We could then also think of adding JsInterop
>> annotations on it, so then we could also pass the model to JavaScript if
>> needed.
>>
>> What do you think?
>>
>> Cheers,
>> Marcin
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "GWT Contributors" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/google-web-toolkit-contributors/R7kNsMPvlDI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-web-toolkit-contributors/9f35afd8-340b-4b64-8f40-410ffa9cdf3d%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAFrnd48DcXCKXxF7QUjQPeuE7us9004qL5JrKFmXioWwCA1Ytw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to