<< 07 September 2005 | Home | 09 September 2005 >>

Mixing Rails or PHP with Java using DWR

DWR has taught me a neat trick when it comes to mixing Java with different languages. Any language will do; Ruby on Rails, PHP, I'm sure we could russle up something with forth or whitespace.

The DWR website runs on Drupal (more on this in a bit) and Drupal is powered by PHP, but it still manages to run with DWR (for example, see the table demo). The trick is that DWR integrates simply at a Javascript/HTML level so, so long as your chosen front end language can produce Javascript and HTML, you're fine using it with DWR.

Part of the original thinking was to make DWR work properly with Struts, Webwork, etc, etc, etc without having yet another framework that takes over. We just discovered that working this way with SpringMVC and Wicket means we can also fit in with RoR and Zope too. All I know of Stripes is what I've read in Matt's blog but I'm sure DWR would fit in just fine there too.

Java and Drupal and Architecture

I think Java and PHP people are on different planets when they think about application architecture.

Drupal is supposed to work with Postgres, and I'm not keen on MySQL (the recent slashdot thread confirmed my feelings on this), so when we started to use Drupal it was on Postgres. But Drupal doesn't support Postgres like they say it does, so I got to digging around in the code a bit. And oooch.

I've seen Drupal people note that it is well architected, so I'd guess there is some logic to it, but I'll admit to not being able to see it. The PHP code is mixed in with SQL and HTML all in the same file. And the SQL seems to be MySQL specific, but there seems to be a processing stage to make it more Postgres compliant (it doesn't seem to work though).

If you tried this sort of thing in Java, you'd be laughed at. So why does this sort of thing go down well in PHP land?

Any ideas?