GWT Best Practice

Google IO 2010 is comming this May 19 - 20 and I am very much excited to know what they have prepared for us developers. I have decided to review the 2009 Google IO and wrote a couple of summary for guides on the best practice with GWT. The following are the list:

Browser History
  • Get browser history right, and get it right early. Back, forward and bookmark.

Event Bus
  • Use it to fight spaghetti code.

  • Dependency injection plus model/view/presnter for the win

Google Gin/Guice
  • Everything might require async call sometimes so assume it does all the time

Command Pattern(Object that embody's calls)
  • Use it to make async tolerable
  • Leverage point for caching, batching and centralize failure handling (inherits the oops something went wrong rather than calling it online).

Groud Work

Lays the ground work for:
  • GWT.runAsync() - choping the parts that can be code split
  • Undo/Redo
  • Offline Work
  • Use command pattern RPC
Always be decoupling

  • The combination of
  • An event bus
  • MVP pattern for your custom widgets
  • Dependency Injectio of app-wide services(Google Gin/Guice)
with this you get...
  1. easy rejiggering of the app
  2. easy to deffer pockey DOM operations(separated to other logic that can slow things)
  3. easy unit testing
  4. Decoupling via event bus
  5. Decoupling paysoff: fast test
Dependency Injection
  • Just a pattern
  • No globals
  • No service locator
  • Dependencies pushed in, preferably via constructor
  • Not had to do manually
  • GIN(client) and Guice(server) can automate it
  • Strive to achieve stateslessness
Unit Test Case
  • JUnit TestCase - standard test case
  • GWTTest Case - test code that requres javascript at runtime. hosted and webmode
  • Selenium TestCase - test through event listener that run against the browser with all the mechanism in place
  • TestSuites - grouping your test cases. Can run in a single suite and onlu incur a single compilation/hosted mode.
MVP - Model View Presenter

Model- empracess/encompasses business objects.
View- contains all the UI components that make up our application. This includes any table, labels buttons...Views are responsible for the layout of the UI components and have no notion of the model.

Presenter-All the logic of our applications, including events that are sourced from the UI Widgets within the view

App Controller - To handle logic that is not specific to any presenter and instead resides at the application layer.

* The presenter should have no knowledge of any widget base code.

Event Bus-is a mechanism for:
a.) Passing events
b.) registering to be notified of some of these events.

During the presentation the word "boiler plate" has been mention and I was so curious about it so I decided to include the meaning.

Boiler plate- the term used to describe sections of code that have to be included in many places with litte or no alteration.


Popular posts from this blog

John Gokongwei Speech before Ateneo 2004 Graduates

High Grounds Cafe - Best Internet Cafe in the Philippines

SM Mall of Asia