Reputation: 431
What does the following mean?
GOALS in GWT Develeopment
We need dumb Views, not dumb UIs (What does View mean here and whats UI in MVP ? its confusing, please explain with a small example, a simple one)
• Avoid state within Views (Which state is it talking about, please explain with a small example, a simple one)
• Swap out Views for different platforms (What is the swapping thing here? does he means change of different technology, say from GWT to Flex )
Please explain using a simple example :)
Thanks
Upvotes: 1
Views: 328
Reputation: 17489
Well I assume it means that you should try to avoid having complex business logic and model states in your Views. The reason why people advocate to keep the views in GWT as dumb as possible is that views have widget related code and whenever you try to test widget related code in GWT you have to fall back to the slow GWTTestCase
and not the fast JUnit
tests.
In TDD (Test Driven Development) you heavily rely on tests and in order to allow for efficient development these tests should run fast.
So what you try to do in GWT is to keep the Views as dumb as possible so they don't require a lot of tests (maybe just integration tests at the end) and to put all business related code in your Presenters. The Presenter should have no widget related code and should handle model states. Then you can use the fast JUnit tests to completely cover your business logic code in the Presenters. See here and here for more details.
Swapping out views for different platforms refers to having different view implementations for different devices for example. It makes sense to have different layouts for a mail application when viewed from different devices.
On a tablet where you have enough screen size you might have a list of mails on the left side and the actual mail content in the center part. However on a phone you will probably only display the mail-list and when you click on a mail the view will be changed to the content of the mail.
The business logic for the mail application is independent of the layout/view. So you try to put this code in the Presenter and design your Views in a way that they can be easily swapped out based on the user-agent for example. You can check out the mobilewebapp sample app in the GWT repository and this I/O conference talk.
Upvotes: 2
Reputation: 1607
some thoughts I learned recently about MVP Widgets, they could not be theorically exact, but they are ok for me and the team I am working with.
That's all, hope this helps you.
Upvotes: 1