Search code examples
gwtmvpgwt-mvpcode-complexity

Reducing code complexity for GWT


I started learn GWT by example on google and my first conclusion is: too much code

Like this:

stocks.add(symbol);
        stocksFlexTable.setText(row, 0, symbol);
        stocksFlexTable.setWidget(row, 2, new Label());
        stocksFlexTable.getCellFormatter().addStyleName(row, 1,
                "watchListNumericColumn");
        stocksFlexTable.getCellFormatter().addStyleName(row, 2,
                "watchListNumericColumn");
        stocksFlexTable.getCellFormatter().addStyleName(row, 3,
                "watchListRemoveColumn");

Does GWT have any extensions for reducing code size and simplifying creating GWT forms?


Solution

  • Nice example (oversimplified but clean conceptually) of GWT UI Design with CSS and HTML is Tags First GWT.

    I agree with you that if one follows generic examples from Google documentation it's not a pleasant experience. The things changed lately though but they don't yet get fully reflected in the Google docs. Try the following: before going on with GWT development watch these 2 presentations: Best Practices and Performance Tips.

    Without using CSS-based UI design, Event Bus, Command Pattern based GWT-RPC, MVP presentation tier and google-gin (GWT implementation of Guice) it's hard to overcome complexity in GWT just like in any other heavy GUI framework.

    If you liked these ideas (described in the presentations above) you might want to consider gwt-dispatch and gwt-presenter that implement some of these patterns.

    Few examples are: GWT MVP Example and Apache Labs Hupa GWT-based webmail

    UPDATE: for latest in MVP design for GWT look for GWT MVP in GWT 2.1 and/or gwt-platform frameworks (among others that may work for you).