Architecting your Google Web Toolkit GWT apps with Model View Presenter ( MVP) At its core, MVP is a design pattern that breaks your app up into the. Main Components of GWT MVP. Framework. • Model. – Responsible for holding raw data. – No business logic allowed (just like any model really). • Example. Modular design for large-scale apps, similar to the widely-accepted MVC approach in “normal” Web applications.
|Published (Last):||28 March 2007|
|PDF File Size:||13.18 Mb|
|ePub File Size:||12.18 Mb|
|Price:||Free* [*Free Regsitration Required]|
Regardless of which one was chosen, I was also tasked with deciding if we should use an existing framework or write our own. To test my “MVP is best for our project” theory, I did a spike to implement it.
Implementing the MVP pattern itself was relatively straightforward, but I did encounter a few issues. I’m writing this post to see if anyone has solved these issues. To try and figure out a solution, I posted the following on Twitter:. Let that turn DOM events into semantic events.
He also pointed me to his tdd-gwt-gae project which shows many techniques for unit testing with jMock and integration testing with GWTTestCase. My strategy is instead of getting widgets from the view and adding handlers, you add handlers to to the view and it takes care of adding them to the widgets that should mfp for them.
This seems to work, but my View interface has a lot of void methods, which is a bit different than standard MVP patterns I’ve seen.
The 2nd issue I encountered is with unit testing.
Building GWT Applications with MVP and Issues with Overlay Types
When unit testing MVP applications, the recommended practice seems to be you should test presenters and not views.
Services fall into a similar “don’t unit test” category because they’ll need to connect to the server-side, which won’t be running in a unit testing environment.
This means I can’t fully test the flow of a presenter if event firing happens in a callback.
In attempt to try different mocking techniques for callbacks, I created a test that uses two recommended EasyMock-ing strategies. The last solution seems like best one, but I’m also curious to know what others are doing. Over a million developers have joined DZone. Join the DZone community and get the full member experience.
An implementation of the MVP pattern. Dependency Injection based on Google’s Guice.
GWT MVP Development with Activities and Places |
A log4j-style logger for GWT. To try and figure out a solution, I posted the following on Twitter: This is where I ran into a major issue that I don’t have a solution for. Currently, I see a few possible solutions to this problem: Modify presenters and services so a callback can be set that is unit test-friendly.
A Comparison of Relational Databases. Opinions expressed by DZone contributors are their own. Learn how to refactor a monolithic application to work your way toward a scalable and resilient microsystem.
GWT MVP Development with Activities and Places
Advanced Linux Commands [Cheat Sheet]. Microservices for Java Developers: Migrating to Microservice Databases. Insight Into a Hybrid Approach.