Sunday, June 7, 2009

Top 10 Reasons for and against Google App Engine for Java & GWT

Background

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. 

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!

10 Reasons For

  1. 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.
  2. 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. 
  3. 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.
  4. Google App engine is free for small deployments. 
  5. 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
  6. 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...
  7. GWT has momentum... With the App Engine for Java just release, and Google Wave as a showcase GWT usage is booming...
  8. 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.
  9. You can utilize the Google DataStore services and use your choice of JPA, JDO or the low-level API to interact with the datastore.
  10. 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
  1. 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. 
  2. 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.
  3. 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.
  4. You are putting all your eggs with Goggle. What if Google turns bad.
  5. 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...
  6. 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...
  7. You have to use the Google login page. This might scare off users.
  8. 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.  
  9. 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.
  10. 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.

Delicious Bookmark this on Delicious

Friday, January 2, 2009

Wicket-RAD Maven Archetype

I am a big fan of the Wicket web application framework. The Wicket-RAD framework builds on Wicket, and through the use of annotations on your domain classes it allows you to really quickly create high quality and maintainable data driven web applications with minimal fuzz.

To allow users to quickly experience Wicket-RAD, I have created a Maven archetype that have you up and running with a fully working database driven web application in minutes.

To learn more visit the project homepage on: http://code.google.com/p/wicketrad-archetype/

Enjoy! 

Delicious Bookmark this on Delicious

Thursday, December 18, 2008

What web applications do I use?

That's the question I will answer now. As long as it's possible I will always use a web-based application instead of an application installed on a PC.

I'll illustrate that by listing the applications I typically install on my PC:
  • Eclipse Java IDE (programming editor)
  • Putty SSH client
  • 7-ZIP
  • PDF reader
  • Tortoise SVN client (source control)
  • Skype
  • Firefox & Google Chrome
For everything else I use these tools:
  • Yahoo Mail - might convert to Gmail at some point, although Yahoo mail is a great application
  • Google Docs - instead of Word or OpenOffice. More than good enough for me.
  • Google Reader - reading RSS feeds, my main source of technology news
  • Twitter - social networking and a great source of technology news. I follow many of the big names in the industry.
  • Facebook - it's not all business, through Facebook I get a feeling about what old and new friends are doing.
  • Remember The Milk - excellent task management that integrates with everything.
  • Assembla.com - hosted Subversion (source control) and Wiki. Perfect for programming projects.
  • Delicious.com - Social bookmarking site. I keep my bookmarks there.
  • Digg.com - Users are voting the most interesting news in many categories. I follow a few tech categories on a regular basis. Lot's of interesting stuff here.
  • iGoogle. Portal that gives me a unified view of information from Twitter, Facebook, Google Reader, Google Notebook, Digg, Delicious, Remember the Milk and Yahoo Mail. Well, that is almost everything. My most visited website.
  • Last.fm. Gives you your own radio stations based on the artists you like. Free and amazing. Until the media industry gets their act together this is my main (and almost only) source of music.
  • Meebo.com. All the major chat clients in your browser, and you only have to remember a single username and password.
  • Blogger.com. Lets me blog with my google user profile...
  • LinkedIn. Professional networking. Excellent way to keep in touch with former colleagues.
  • Plaxo.com. Professional networking. Share contact information with your current and former colleagues.
  • Dropbox.com. Not much need for physical file-sharing or file-storage when everything is already in the cloud. For the occasional need dropbox is doing the job and staying out of the way.
All the applications work well in the browser on my Nokia mobile phone. I do not really consider a web application seriously unless it's optimized for the mobile web. I do not use mobile phone client applications much, they have the same problem as desktop applications... Last.fm is an exception.

I'll add that for most of the applications above I have tested one or more competing services. The one I am using is the one I have found to be the best one. Ease of use, mobile presence and open API's for integration with other web based services are a few of my main criterias when selecting a web based application.

Oyvind

Delicious Bookmark this on Delicious

Thursday, October 2, 2008

Java Development on Asus Eee for two weeks.

The motherboard on my main work laptop flunked, and my replacement laptop for the last two weeks, while being on the road, has been an Asus Eee 901 netbook that i picked up for about 400 Euro. 

Specs: Windows XP Home, 1.6 ghz Single Core Intel Atom, 1gb mem, 12GB SSD, 8.9 screen, small keyboard, external mouse.

My development environment looks like this:
  • Eclipse Java IDE
  • Maven building and running Jetty server in the cmd window
  • Google Chrome for surfing
  • Firefox for development
  • MySQL Query Browser for SQL stuff, MySQL DB is running remotely
  • Java toolkits are Wicket, Guice, Hibernate++ 
  • Notepad++ for .css and HTML coding
  • Opus file manager

I did not have big expectations for getting much work done... So how did it go?

Findings:
  • Asus Eee is impressing me in areas of: 1) speed 2) battery life 3) noice 4) heating
  • When running on overclocked 1.8 ghz (change with dedicated button) I have not experienced any delays after I got Windows trimmed down... It actually feels fast...
  • Java development in Eclipse is workable. I am only showing the Package Explorer and the Java Editor views, and I often maximize the Java Editor by double-clicking the tab. Code completion and error highlighting is snappy.
  • HTML and .css editing works well in Notepad++. This gives me good syntax highlighting and more screen estate than in Eclipse, but not the code completion and error checking... Plus Notepad++ is light and fast! I really need that extra real estate for the HTML coding... Plus I would need to have some other editor than Eclipse running anyway for opening of random files not in my Java project...
  • Surfing in Chrome is nice! Have to say. Snappy and more real estate again without a need to go fullscreen. 
  • The Eee goes in and out of standby in a few seconds. Nice for battery life.
  • I get 5-6 hours of busy work done on a single charge. That is really nice. And that is without battery saving mode...
  • It does not get noicy. Never. It does not get hot. Never. Other small laptops I've had have always gotten hot and noicy unless on lowest performance setting.
  • The keyboard is small. I can touch type on it with little problems. Lucky for me that I have piano fingers.
  • The touchpad gets in the way from time to time when typing. Better after installing the touchpad driver from Elantech(why not installed by default?). Then you can turn off tapping support...
  • The screen is small. 1024*600 is not much. You must remove toolbars, statusbars as well as set the Windows taskbar to auto-hide. And all windows must be maximized... No overlapping or side-by side windows. And alt-tab is king for changing windows.
  • If you want to use your Eee for development I do think it's almost a requirement that you trim down your Windows XP installation. I did the following steps: 1) Remove all unneccesary services. If you google this you will get lot's of advice. I was surprised how many service can be turned off, about 15 I guess. 2) Uninstall all unneccesary software. You will need the disk space, especially on the OS partition. 3) Use a tool like WinPatrol to disable all unneccesary startup programs. Anything that is not a "Microsoft Corporation" program is a candidate. I disabled like 10 programs. Had to re-enable one of the touchpad programs as well as one program that enables the use of external headset.
  • It's smart to have your most used programs installed on the faster C: drive. This mainly means the browser. Everything else you install on the D: drive because space is limited on the C: drive.
  • Limit the number of open programs, as well as the number of open browser tabs. Use lightweigh programs instead of heavyweight alternatives. Don't install unneccesary plugins.
  • Turn off wi-fi, webcam and bluetooth. In fact I uninstalled bluetooth. I have most of my data in the cloud these days, so no need to connect to my phone... You can enable these programs with a single click.
  • Use remote services instead of local ones if you have a fast internet connection. I run MySQL remotely. And use web-based programs instead of local ones. I use Google Docs, Remember The Milk, Google Notepad and web based email. Then I have Twitter, Facebook and Google Reader on my iGoogle page. All of these services also have mobile versions as a bonus, no stupid syncing. (I never do syncing to PC on any computer btw, I only use services with mobile versions).
  • I haven't tested this myself but I imagine that keeping your project modules small helps on the performance in Eclipse. I guess this is not only true for the Eee. I always split my projects into several "independt" modules. I.e. web, services, utils, shared etc... Then you only keep the module you are working on open in Eclipse.
  • Don't run programs you absolutely don't need to get your job done... I.e messengers, skype etc...
  • Offload processing to your mobile phone. This is 2008. You can run your email and messenger on your phone, with excellent alert options. Then you open the program on your PC only when you need it. 
  • I use a bluetooth USB mouse when coding. For other purposes I use the touchpad.
  • I use it mostly with my 3G data card. I have a feeling it drags less battery than wi-fi?
  • Microphone and speaker works excellent. I have stopped using a head-set when using Skype as people say they can't hear the difference. 
  • My Eee starts up from scratch in 40 seconds. You see the desktop after around 35 sec.
  • I don't store anything secure on the machine (well, i hardly store anything at all, just copies of the source code). And don't visit any sites where I give away secure information. Then we can be a bit relaxed about the security, and gain some more performance...
  • www.portableapps.com is your friend. Why install programs on your machine when you don't have to? You can put these on a USB drive or in a folder on the PC. No more messed up registry...
  • I use RocketDock as a program launcher. It's just the fastest visual way to launch a program. And when it's fast to launch a program, you don't have to think twice before you shutdown programs. Remember to shutdown programs you don't use at the moment. It means more resources to the ones you have open. RocketDock and WinPatrol are the only convenience programs I have installed, that runs in the background. Both are very lightweight.
  • And: I really think you need to dedicate the machine for development purposes to keep the performance. I don't think the Eee can be both your multimedia machine, social networking hub and a development PC. You gotta cut the crap and focus on what you want to use the machine for. But then it's only 400 Euros, so buy 3 if you want it all :-)
Conclusion
  • Asus Eee 901 is a capable development machine on the road for Java, using a typical open source stack of products, as long as you take some precautions, and can live with the keyboard.
  • The raw performance of the machine is much higher than I expected. Ignore the bullshit from BestBuy etc about a netbook being a "companion" machine for web surfing, they are just protecting their laptop sales.... This is state of the art technology, with some of the best performance / battery / weight / noice/ heat characteristics of any machine this day, and if released a few years ago it would have easily set you back several grands of Euro/Dollars...
  • The main problem of the machine is the keyboard size. It takes some getting used to, and it's an advantage if you have piano fingers and/or experience with smaller keyboards. For me it is not a showstopper.
  • And if you can live with the restrictions you have a mega-cheap superportable workhorse that you can slip in the outside pocket of your bag without a need to drag a charger with you for up to 6 hours work.
  • And finally, I will never buy a PC without a SSD drive again. I credit both performance, battery life, noice, heat and weight features partly to the SSD drive. 
Happy eee'ing!


Delicious Bookmark this on Delicious

Monday, September 29, 2008

CSS Editor - Kompozer

It was time to give the UI of the website I am working on a facelift. Nothing too fancy, but something simple that won't scare off the users when it is released... Before, I have far too often reverted to the safe path of tables and plain HTML tags, before getting myself into too much .css trouble. This time I decided it was time to put a bit more force behind the goal of handling the layout only with .css stylesheets...

First thing I looked into was finding a better editor than Eclipse for css and html... Decided against shelling out for Dreamweaver f0r now because of 1) price and 2) my favorite development OS is Ubuntu...

After some reasearch I figured out that many people are using the open source Kompozer (based on Nvu) editor, and decided to give it a try. 

My experience so far is that it is definately a helpful and worthwhile to have tool while designing your pages. It is definately no Dreamweaver replacement, but it provides you with an editor that let you preview your changes instantly, gives you easy access to the most used style settings, and provides you with an overview of your page structure in one tool.

I also had some problems while using Kompozer. The undo as well as the publish  function must be working in a way different than I am expecting, as I have lost work many times. I have resorted to not using any of those two functions, and making frequent backups for now... I am planning to research this more...

Overall I am happy that I took the time to learn Kompozer and is looking forward to continue to use it on all my machines.

Note: As an added bonus there is a "portable" version of Kompozer available, so if you are on windows you don't have to install another program. Goes nizely together with Portable Firefox and Firebug for the css development...

Update: My Kompozer usage has dropped to almost zero, as I managed to get my stylesheet automagically replaced with an old version again. I will have to Google this problem a bit and find a solution before I have the guts to spend any time with Kompozer again...

Sunday, September 21, 2008

Assembla SVN, Wiki and Track

As a software developer you need access to a few basic services. My needs include a Subversion repository, a Wiki and a bug tracking tool. I used to host all of this myself, but I got tired about worrying about security upgrades, diskspace, downtime, changing OS versions etc...

So I have swithched to use Assembla. They provide hosted SVN, Wiki and Track access, and their basic subscription (meeting my needs) is free. I'm currently only hosting my Maven repository myself, I wish they also offered that...

I have been using Assembla for more than a year now and have experienced no stability issues so far. So thumbs up for Assembla, reccomended to everybody!

(no, I am not associated with Assembla in any way...)

Saturday, September 20, 2008

1st blog picture

A pic of my laptop with my first blog post... Historical. Picture was taken on my Nokia E71 and posted to blogger.com by sending an email directly from my phone to the blogger.com email I set up... Sweet.