Extending and Integrating Popular PHP Applications with IBM Websphere sMash
IBM ILOG Blogger 270002NTYA Visits (2553)
At IBM Impact last week, I had the opportunity to learn more about an IBM initiative that is interesting from a Web 2.0 development and cloud computing perspective: the Websphere sMash project. Rob Nicholson, a Senior Technical Staff Member ran over the key features of sMash.
What is IBM Websphere sMash?
In order to build these applications, sMash features a range of tooling from a dynamic scripting interface through to a visual flow editor (which looks as intuitive as the popular Yahoo Pipes interface). There is an IDE that runs inside a web browser (in addition to the Eclipse IDE), which is ideal if you are running sMash in the cloud.
Rob stresses that these are tools for developers: you really need a strong understanding of the underlying code, even when using the visual tools.
For the Websphere sMash project, the team took the PHP runtime and created Java version. This compiles PHP into Java bytecodes that can be run on a Java Virtual Machine. Key here is the close connection between Java and PHP:
This means you can use the best tool for the job, eg. employ PHP scripts such as Smarty, Drupal and SimpleXML, and on the Java side dip in to popular libraries like Apache Lucene, POI and Eclipse BIRT.
PHP in action
For looser coupling, the Zero programming model allows PHP to interact with other Java/Groovy modules.
This slide shows the basic use of the Java Bridge:
The power here is that a PHP programmer can interact with Java without needing to know the underlying language. That same programmer can import Java classes and use them as if they are Java classes: even adding a new method into the class using PHP.
You invoke PHP using Event Handlers. Some examples:
In terms of working with services, given the focus on Web 2.0, the preferred method is to use RESTful services as opposed to say, connecting with an enterprise service bus in an SOA model (although this may work).
So which PHP applications can currently run in sMash? Here are some examples:
There are a number of other applications too. One limitation can be the C extensions that different applications rely on. Not all of these have been converted for sMash. At this stage, if you do run into problems, you may find advice on the vibrant forum, and if you let the sMash development team they can work on adding extensions users require.
Note that Webpshere sMash will run PHP 5 scripts and requires Java 5 SE or later.
On the question of performance, sMash currently performs at around the same speed as the standard PHP installation. Major advances have been made over the last year and the team are currently working heavily on increasing performance. In time it should be faster because of the advantages of using a just-in-time compiler.