开发者

what is the right approach to start a GWT application?

  1. Do I design the basic skeleton HTML and start from there by inserting components and actions through java code ?

  2. Plan on building the whole thing as a java program by designing the nitty gritty details using java code ?

  3. Or is there a better way that I don't know 开发者_开发技巧about ?

Apart from that, how easy or complex is it maintain the code ?

I am new to GWT and I know the very basics.

Thanks in advance for your inputs.


My insights after working one year on a GWT/Seam project. I assume that there is no existing website meaning you can start from scratch. If there is one I suggest you to honor your legacy and to improve it by selectively inserting GWT widgets into specific places of the existing html pages (some more details here).

Our development process can roughly be summarized by the following steps (feedback loops, standup meetings and such omitted, you know the deal):

  1. Feature Request: contains the description of the desired functionality at a high level

  2. Wire Frames: a high level UI that gives a first impression of how the functionality is going to be provided to the end user and how it is integrated in the existing app (without any bells and whistles)

  3. Final Design: the final extended UI of the new feature created by our designer (photoshop only, no html skeleton, no css)

  4. Implementation and Testing: I'll focus on the implementation and describe how it changed over one year

We started our project with GWT 1.6 which lacks any support of UiBinder. So the decision was 1) build the whole client side of our app with GWT (i.e., java code) or 2) build our pages with JSF (since we're using Seam) and extend them with GWT widgets. We decided to go for the second option mainly because we liked the idea of pushing most of the state to the clients and let them do the processing. And doing all in java was promising with our strong background in java development.

Implementing the business logic was no trouble at all. What took us the most time was building the UI: composing the layout of the pages and styling them in java is time-consuming and error-prone. The gap between final html (based on the designs from step 3) and GWT widgets was too big.

Switching to UiBinder was the first step we took when GWT 2.0 was released. Since we had to rework most of our client code anyway we also adapted the MVP pattern. Productivity raised significantly after that: one developer was implementing the business logic (mainly the presenter part of MVP) while another was busy building the view part (.ui.xml and the widget). Unit testing also became more easy because the main functionality was now nicely separated in the presenter part (and GWTTestCase was part of the past).

The next major step we're currently doing is to switch from our own implementation of MVP to a more elaborated one (namely gwt-platform). Rationale behind this decision: DI through GIN (dependencies are clear and code gets cleaner), nice support for browser history (we recklessly neglected it - a huge mistake!), code splitting support, command pattern for async calls and some more.

My conclusion after one year of experience: use UiBinder for the UI part and go for a clean MVP architecture. The learning curve might be steep but going down the same road so many GWT developers have takes you definitely more time.

...my 2 cents :)


My advice is to start off by thinking about your interface. How it's going to look and most importantly how it's going to function. Think about what problem your app is going to solve for its users, and how it can do that with the least amount of clicking and scrolling around. Prototype your interface, UiBinder is good for this, then start bringing it alive with event handlers and service calls.

The easy thing to do is to implement a feature and then build an interface to suit that implementation, but you tend to end up with something that's not as nice to use. You might want to consider your data model/db schema too, but don't fall into the trap of building a clunky CRUD application like so many other developers.

GWT code is pretty maintainable, certainly more so than trying to build a cross-platform webapp without it in my experience. You should take a look at google-gin and maybe gwt-mvp, they help to keep your code modular and easy to test.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜