Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Confusion around the whole GWT MVP vs Activity and Places

Tags:

After reading a while and watching Google IO videos, I am still confused on how MVP relates to Activity and Places.

I found a thread posted a while back --> GWT 2.2 MVP vs. GWT 2.1 Activities-Places

"MVP architecture. MVP is the concept, and one of the ways to do it is the places-activities framework"

I also hear "A presenter is analogous to an Activity"

We can gave "Activity and Places without MVP"

We can mix in "Activity and Places with MVP"

"MVP is nothing but how we organize our Project so that we can test and organize code easily"

Then I am trying to figure out stuff like this --> http://code.google.com/p/gwt-platform/

I am really confused. I would want a one stop thread to end all the confusion.

like image 524
Nitish Upreti Avatar asked Jun 14 '11 05:06

Nitish Upreti


1 Answers

TL;DR: Places and Activities are in no way related with MVP.

Places is about navigating into your app: you go from one place to another. And Activities builds on top of Places to help in binding "what you see" with "where you are":

  • when I'm on the home page for SO, the main part shows the list of questions in all topics, the top of the right side shows my favorite tags and helps me setup tag filters, then below is an add, and below the add is a list of recent tags, then a list of recent badges.
  • on this question page, the main part shows the question and its answers, the top of the right side is replaced infos on the question's tags, followed by an add, linked questions and then related questions.

Each one of these "parts" (region) are managed by ActivityManagers that listen to PlaceChangeEvents and ask their associated ActivityMapper which Activity to show in that region.

It's all about navigation.

There's no relationship with MVP (despite what the official docs say). If you use MVP though, you'll likely make you activities "presenters", in control of a "view" (the one the activity will pass back to the AcceptsOneWidget received in argument to its start method). This is not a rule though, and, for instance, Google is experimenting, in the mobilewebapp sample, with decoupling activities and presenters.

like image 53
Thomas Broyer Avatar answered Nov 20 '22 21:11

Thomas Broyer