What Is GWT?
Before we get into building mobile apps let’s get to know GWT. GWT,
or the Google Web Toolkit, is a set of tools, libraries and plugins. GWT
was first released as an open source project by Google in 2006. They built
it as a stable platform for their own web based applications that had to
run across 100% of browsers, even the old broken ones.
At its core, GWT is a special compiler that can transform Java to
JavaScript, along with a minimal runtime. It lets you write mostly
standard Java code, then compile it to JavaScript for running in a web
browser or other HTML environment. Once compiled there is no Java code
left. The generated code runs entirely in the user’s web browser as
JavaScript, no applets required. GWT has its own runtime consisting of a
minimal set of standard Java APIs like List and String. These are
implemented in JavaScript so that your code can call them even when
converted. You can see the full list of emulated Java APIs at http://code.google.com/webtoolkit/doc/latest/RefJreEmulation.html.
GWT isn’t just a compiler though. It is also a set of cleverly
designed compile steps and runtime libraries that handle browser
differences. The compiler can generate different output for each browser,
ensuring that the code runs properly no matter what browser the user has,
even IE6! The compiler knows how to optimize object references, take
advantage of JavaScript language tricks, and reduce memory usage. Much
like a traditional compiler it produces code much better than you could
write by hand. Even better, the compiler improves over time to take
advantage of the evolving browser landscape. Your code will get better
without having to rewrite a single line.
You are currently reading a PREVIEW of this book.
Get instant access to over
$1 million worth of books and videos.