concept layer in category gwt

appears as: layers, layer
GWT in Action

This is an excerpt from Manning's book GWT in Action.

As we wrote in the introduction, we should agree on what we’re talking about when we say MVP. It’s an approach to dividing code into layers that solves a number of issues with code, which can occur if you build an application on an ad hoc basis. Projects built in an ad hoc manner suffer from four intrinsic problems:

Because views are isolated, we can swap them out for a layer that emulates user interaction but doesn’t create GUI components, therefore avoiding the expensive GWTTestCase approach, and we can instead use lightweight and efficient JRE tests—you can see this pictorially in figure 15.7.

Figure 15.7. Visualization of components involved in an MVP application in production versus testing (to avoid use of the expensive GWTTestCase approach)

It’s not only for testing that we can swap out layers. In the first version of this chapter’s example, we’re using the legacy approach to user interface development by creating it in code. In the next section you’ll see how easy it is to swap that for another user interface (and after that we’ll come to the interesting topic of code splitting).

15.4.1. Swapping out layers

You saw that you might want to swap out layers, perhaps for efficiency of testing, perhaps for presenting a brand-new view (it’s conceivable you’ll have one view for desktop web applications and one for mobile applications—but the underlying presenter and model are the same).