The Unpossible Programmer

Wednesday, May 17, 2006

"Open"ing Pandora's Box

Have you heard of Pandora.com yet?

Pandora.com is a nifty little web site that may just change how you discover music forever.

Here's the low-down. There is a small, dynamic Flash application on Pandora.com that lets you make custom internet radio stations.

This is insanely cool for three reasons:
  1. It works through a proxy for those of us "trapped" at work
  2. You can enter in any artists you like, and it tailors the radio station to you
  3. It was developed using OpenLaszlo (didn't think I'd make a list without including something about programming, did ya?)
Just what the heck is OpenLaszlo? Well, for those techies out there - you know that Flash apps have historically been client-based (meaning very little, or no, interaction with databases).

Macromedia (Adobe) Flex set out to change this by designing an architecture that allowed for dynamic Flash apps - not just apps that were based on dynamic page code (php, asp, jsp, etc.), but Flash apps that were actually compiled and run on-the-fly based on an xml spec. Which is a very cool idea, right? Oh, but wait; your IT budget is already stretched too thin, how could your team possibly shell out the bucks for Flex? (cause, coming from Macromedia/Adobe, its not going to be cheap).

Enter OpenLaszlo - which does the EXACT same thing as FLex, but at no cost to you - the poor budgetarily-constrained programmer. Now THAT sounds good. But, hold on. This isn't for the faint of heart.

Using OpenLaszlo (or its pricey counterpart Flex) means re-thinking how you design your web apps. We're not talking straight HTTP Request/Response models any more - OpenLaszlo apps can read in XML from any source you can think of; SOAP (Web Services, etc.), dynamic XML built by ASP/JSP/PHP, static XML, SQLXML (SQL Server's implementation of SOAP), or anything else you can imagine.

I haven't had a lot of time to try out OpenLaszlo, but I was able to get a fairly simple example working that was based on a Java EE back-end. Basically, my thought was that the Java EE stuff could take care of easily (and MVC-ily) providing any database data I'd need. Here's what I came up with:

  • Data tier, powered by factories/dao's using Mr. Persister
  • Business logic tier, utilizing Stateless Session EJB3.0's (in the latest version of JBoss4.0.3+)
  • Presentation provided by Struts/Velocity
"Whoa, hold on - Struts AND Velocity?", you say. "I thought it had to be xml?"

Excellent point! By making use of another cool Java lib called XStream, I was able to easily turn my Java objects into XML, easily displayed by the Velocity page (which really doesn't care what it's outputting - html, XML, chocolate pudding, etc.).

Hook in the path to the Java app as OpenLaszlo's datasource, and presto! Full-fledged Java EE/Flash goodness. I know that's a REALLY toned down explanation, but it should implant some seeds of thought (for noodling).

Oh, by the way, did I mention to check out Pandora.com yet - it's sweet! You'll either find some music you like, or at the very least, a cool implementation of an emerging web technology.

0 Comments:

Post a Comment

<< Home