Palm's Hot Apps Promotion, and the Zen of Servlets

I'm excited to show you all one of the things I've been working on since I joined Palm.

Palm Hot Apps

Today we launched a new microsite called Palm Hot Apps. This is a leader board for our Hot Apps promotion, where the top selling & downloaded apps compete to earn bonuses between $1,000 and $100,000 dollars. Since this is a competition we wanted to have a constantly updated site that shows who's winning right now and who might be winning in the future.

If you are a JavaScript developer, or interested in mobile app development in general, or just a Palm enthusiast, you'll definitely want to check out the site. As of this posting you can earn a bonus in the entry level bracket with only $500 in sales for a paid app, or 12k downloads for a free app (see the site for full details). The competition is still wide open, and webOS is really, really easy to develop for, so I urge you to build something cool and compete.

Since this is a Java blog you might be interested to know that I wrote the entire backend for the microsite in Java. I'm also happy to say that I didn't use any frameworks at all. There's a certain sense of zen peace that comes from using pure JSPs and servlets. Where the code really is a direct expression of what is really happening underneath.

I went with what my amazingly talented engineer friend Brian Goetz has often said: build the simplest thing that could possibly work. In this case I considered the following constraints:


  • This is a promotion with a deadline, so the site needs to be launched ASAP

  • To minimize risk, use technology I know very well

  • The site will be high volume, so minimize state

  • We need a way to expose data to 3rd party JavaScript widgets and other websites in the future.

These constraints led me very quickly to one solution: Linux + Tomcat + JSPs & Servlets. The choice of Java is a natural, since it's fast and my 15 years of experience means I can knock out code in Java faster than any other language.

Linux and Tomcat are known quantities. I personally still hate Tomcat's configuration system (why can't I specify init params without having them nuked when I update the WAR!!!), but it performs very well and every conceivable issue has already been found, fixed, and documented on endless websites.

The choice of JSPs and Servlets was a bit more subtle. Since there is almost no state in the site I didn't need the state management capabilities of the typical web framework. The graphics would be coming from a designer so JSPs were a natural fit for turning pure HTML into a webapp. I used servlets for all of the data access because it easily lets me create JSON webservices that can be used on the site or in embeddable widgets.

Now, don't get me wrong. Frameworks have their place, especially in applications with more complicated workflows and state. This site, however, was best served with the simplicity of servlets and JSPs. Most of all, there's a clean mapping between what the user sees on the screen and what's happening in the code.

Dare I say it: it makes the code beautiful. It really was a joy to just sit down and write some beautiful code with a language I know well and love. Here's to another 15 years of great Java development.


AttachmentSize

FirefoxScreenSnapz009.png121.62 KB

Talk to me about it on Twitter

Posted April 12th, 2010

Tagged: java.net