While drinking my coffee this morning I caught up on my PHP Architect mag (yes, I am 3 months behind). The interesting bit was Marco’s rant on the “insurmountable” difficulties in code interoperability. One of the examples was why we can’t use WordPress plugins inside Serendipity.
The fact of the matter is that it’s not such a big deal. Porting a plugin from WordPress to Serendipity is usually trivial, and as we see more web-services based plugins (stuff like the awesome askimet) the task becomes simpler and simpler.
Interoperability is overrated, the more you think of it the more complex it gets. As you start throwing in new factors into the equation (how will this interoperate with a java/c# application) you start to develop monsters like JSR 170 which solve a lot of problems on paper, but in reality are too unwieldy to be truly useful.
My steps to interoperability are pretty much the same as steps to writing good code.
- Use as much abstract code as possible: Most problems have already been solved in stand-alone PHP packages such as those found in PEAR or Zend Framework. These are (mostly) solid and (mostly) well tested solutions, use them!
- Create new libraries to encapsulate new functionality: If you need to add some complex functionality, create and publish a reusable library which encapsulates the functionality. This will make your work not only simpler to interoperate with other applications, but also enable your code to function in scenarios you may never think of.
- Keep your “glue code” as simple as possible: When it comes to the proprietary code which glues all your pieces together, keep the probability of someone porting the code to another platform, and stay as simple as possible.
- Use services: Whenever possible make your application available as a webservice. This will offer a level of interoperability that is available to any application regardless of shape, size and programming language.