I have spent the last 2-3 months coding an application in GWT on Google App Engine that is soon ready to go into production. The application contains about 100 classes and approximately 7000 lines of code. It is not a large application by any means, but it is not something you can throw together in a weekend or two either. As far as complexity goes it is a fairly standard database driven application with users storing and retrieving business data to/from the datastore.
Bookmark this on Delicious
Before starting the application i wrote a few smaller demo type applications (effort measured in days, not weeks) using GWT and the App Engine before deciding on GWT and the App Engine for my main application. Besides those sample applications I have little real-world experience with GWT. I do however have about a year of experience with the Wicket Java framework which is also component oriented, and shares many of the same concepts with GWT.
What I am trying to do with this blog post is to list what I think are the top 10 reason for and against choosing Google App Engine and GWT, as packaged together by Google, for your next project. And I would love to hear what is your opinion about the matter!
What I am trying to do with this blog post is to list what I think are the top 10 reason for and against choosing Google App Engine and GWT, as packaged together by Google, for your next project. And I would love to hear what is your opinion about the matter!
10 Reasons For
- No Ant or Maven. Ant and Maven are great tools. But what is even better than Ant and Maven? Yes, no Ant and Maven at all. With App Engine and the App Engine Eclipse Plugin you have just-in-time compilation, one-click debugging of your application and one-click deployment. And it works! The Plugin also gets you started with a sample project in seconds.
- Tons of online help and an active community. There are lots of developers with almost exactly the same environment as you, both when it comes to development and deployment, so you have a really high chance of quickly finding an answer to your problem. Almost every time I have had a problem I have found somebody else with the exact same problem through a simple Google search. And the App Engine for Java has only been available for a few months.
- GWT gives you very high productivity. It makes both coding and refactoring your Ajax code simple, as you get to code it all in Java. GWT is nice, and I find the API and the components simple to use and well thought through. I am not a big fan of the request/action based Java frameworks, preferring the component based frameworks. If your application is "desktop app" like and suited for a "one page" layout I think GWT is a great framework. With GWT you get to code your application taking advantage of powerful object oriented constructs like inheritance and composition.
- Google App engine is free for small deployments.
- You don't have to maintain your server. Setting up Apache, Tomcat/Jetty and MySQL is fun but it's more fun not to have to
- Debugging is a breeze. The App Engine Eclipse Plugin is set up for debugging of both client (the Java that will be compiled to JavaScript) and server code out of the box and it is working great. I know you love your Firebug, but Eclipse debugging of Java is actually nicer...
- GWT has momentum... With the App Engine for Java just release, and Google Wave as a showcase GWT usage is booming...
- You can utilize the Google User Management services. You get Google's security and reliability for free. And you don't have to spend time building services for creating account, forgot email, change password and so on.
- You can utilize the Google DataStore services and use your choice of JPA, JDO or the low-level API to interact with the datastore.
- Your application will scale. Google's servers and services are set up in a way so your application will scale indefinitely. And you don't have to worry much about how they achieved it. Disclaimer: Google App Engine does not prevent you from doing stupid things with your data that can trash any application's performance.
10 Reasons Against
- The appstore ain't for every Java application. There are some limitations on how you can use the Java language and environment. I am not going into too much detail here as the limitations are widely discussed on the internet. The main limitations as I see it is that you have to think about how you use the session, as your application can be running on multiple servers at the same time and you have no guarantee that two requests from the same users go to the same server. The second biggest limitation if you ask me is that you cannot spawn your own threads.
- Creating GWT services is a bit laborous. Every "service call", that is a call between the client (compiled to Java Script) and the Java web application, has to exist in an Async interface, a service interface and in the implementation class. This is a bit more laborous than the simple bean call you could get away with in a non-GWT , non-Ajax world. And then you have to create a callback method to handle the asynchronous return from the service. I'm sure it is both good design and scales great, but it is a bit labourous. I guess there is no free lunch after all.
- You have to understand "event driven design". This is natural to you if you have a background with desktop UI development and/or Java Swing, but might take some getting used to if you have been developing Java web applications with a framework like Struts or one of the likes for the last 10 years.
- You are putting all your eggs with Goggle. What if Google turns bad.
- What if Google App Engine goes down. The backup strategy is difficult. You cannot simply set up a backup App Engine environment on i.e. Amazon EC2...
- Access to production logs... You are stuck with the web interface. You have no terminal access to production systems and cannot rely on the powers of find, grep and regular expressions to hunt down the error on the production server...
- You have to use the Google login page. This might scare off users.
- GWT, persistence and serialization issues when using DataNucleus. These are also widely discussed on the forums. There are some workarounds, and best practices. The simplest but also most laborous solution is to create an extra layer of value beans that is being passed between the client and the server, in addition to the beans you are persisting to the database. I have not found the need to go to this step for my application yet, but sometimes I have to copy the beans from one list to another, or similar hacks in order to "clean" the "enhanced" byte code. More info on Google.
- You won't learn your Ajax. Lots of developer positions today requires detailed knowledge about JavaScript, Ajax and one of more of the libraries supporting JavaScript and Ajax. GWT is shielding you from the details of JavaScript and Ajax to a great degree, so you won't gain this knowledge.
- You won't learn your JSF. I am no JSF fanboy but as JSF is a standard it is widely used and considered a "safe choice" by many software managers and architects in the industry.
What didn't make the list...
Pros
- You can utilze the Google Application Management console, logs, db viewer etc...
- You can utilize other Google services (email, memcache etc)
Cons
- Your users have to have an account with Google Accounts
- It's still in beta and a sometimes buggy.
- Not all Java classes are supported for GWT client classes. Joda Time and more are not.
- No language support for the login page yet.
So, again, what do you think are the main reasons to use or not to use Google App Engine and/or GWT? I would love to hear your opinions.