Activities versus presenters - best practise

30 views
Skip to first unread message

Raphael André Bauer

unread,
Nov 26, 2010, 8:40:43 AM11/26/10
to google-web-toolkit
Hi,


just a simple best-practise question.

We are using GWT 2.1, mappers, activities and views. Everything works nicely.

But sometimes we want to use activities (aka presenters) and views
without a mapper. We could switch from an activity back to good old
presenter and a custom view interface that exposes eg. "Widget
asWidget()" or so.

But we could also stick to activities and their start(...) method. Of
course the activity would not be managed and would have no life cycle.
On the other hand it would be only a single programming model and we
would not need to define our own view interface.


Does anybody have an advice how to handle that "best"?


Thanks!


Cheers,

Raphael

Thomas Broyer

unread,
Nov 26, 2010, 9:01:39 AM11/26/10
to Google Web Toolkit


On 26 nov, 14:40, Raphael André Bauer <raphael.andre.ba...@gmail.com>
wrote:
> Hi,
>
> just a simple best-practise question.
>
> We are using GWT 2.1, mappers, activities and views. Everything works nicely.
>
> But sometimes we want to use activities (aka presenters) and views
> without a mapper. We could switch from an activity back to good old
> presenter and a custom view interface that exposes eg. "Widget
> asWidget()" or so.
>
> But we could also stick to activities and their start(...) method. Of
> course the activity would not be managed and would have no life cycle.
> On the other hand it would be only a single programming model and we
> would not need to define our own view interface.

I don't understand that last bit. Activities don't define any "view
interface" (Activity != MVP, contrary to what the doc says); any
Widget implements IsWidget.

> Does anybody have an advice how to handle that "best"?

If you go with the "Activity model", developers will expect their life-
cycle to be respected, which means adding tests that your "container"
is not breaking it.
If you don't use Activity, it'll be clear for the developer that the
life-cycle is different.

Other than the life-cycle though, I can't find any difference between
the two approaches.

matttai

unread,
Nov 26, 2010, 5:49:01 PM11/26/10
to Google Web Toolkit
I think everyone is misinterpreting the statement in the documentation
"Activities are analogous to presenters"

the exact definition of analogous is : "similar or equivalent in some
respects though otherwise dissimilar"

the key part of what people are missing being 'otherwise dissimilar'

it seems that everyone is taking that statement as having said both
activities and presenters being similar only...!

Raphael André Bauer

unread,
Nov 29, 2010, 4:20:20 AM11/29/10
to google-we...@googlegroups.com
On Fri, Nov 26, 2010 at 3:01 PM, Thomas Broyer <t.br...@gmail.com> wrote:
>
>
> On 26 nov, 14:40, Raphael André Bauer <raphael.andre.ba...@gmail.com>
> wrote:
>> Hi,
>>
>> just a simple best-practise question.
>>
>> We are using GWT 2.1, mappers, activities and views. Everything works nicely.
>>
>> But sometimes we want to use activities (aka presenters) and views
>> without a mapper. We could switch from an activity back to good old
>> presenter and a custom view interface that exposes eg. "Widget
>> asWidget()" or so.
>>
>> But we could also stick to activities and their start(...) method. Of
>> course the activity would not be managed and would have no life cycle.
>> On the other hand it would be only a single programming model and we
>> would not need to define our own view interface.
>
> I don't understand that last bit. Activities don't define any "view
> interface" (Activity != MVP, contrary to what the doc says); any
> Widget implements IsWidget.

That was misleading. Sorry. I meant our own "presenter" interface (aka
activity). Nonetheless you answered my question correctly :)

>
>> Does anybody have an advice how to handle that "best"?
>
> If you go with the "Activity model", developers will expect their life-
> cycle to be respected, which means adding tests that your "container"
> is not breaking it.
> If you don't use Activity, it'll be clear for the developer that the
> life-cycle is different.
>
> Other than the life-cycle though, I can't find any difference between
> the two approaches.

Okay. thanks a lot for that answer Thomas. I think we are using the
notion of using GWTs activities even if they are not lifecycle managed
for the sake of simplicity.


Cheers,

Raphael

>
> --
> You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
> To post to this group, send email to google-we...@googlegroups.com.
> To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages