Why integrate PHP and Java?
I've been asked by a number of developers, both PHP and Java, why I think that PHP is better than Java or vica versa, and why I think PHP and Java integration is A Good Thing.
It's easy to argue against, if you're being stubborn, which a lot of them are.
Java arguments against:
- PHP is not a 'nice' language - it's hacky and amateurish (This is their opinion)
- Why not just use x,y, or z - i.e. Why on earth don't you try to integrate a more modern language if you really have to do it at all?
- Don't want to have to learn two languages
PHP arguments against:
- Hard to host - This is fair enough, but to be honest, we're talking about applications where hosting is controlled by you - e.g., enterprise
- No additional features. Ah, well, this isn't exactly true, and integration provides an avenue to rapidly extend PHP in exciting ways using Java. It also provides alternatives to clunky parts of PHP, like XML support, low level network and file access, etc.
- Slow to develop
My arguments for:
- Both languages have weaknesses. PHP's weakness comes partly from lots of hacky old procedural code (I'm thinking of old apps like PHPBB and Joomla here. While I thank them for the rise of popularity of PHP, they can be horrible to work with), and partly from Apache. There is no 'Application Scope' like in Java and large applications can be hard to optimise. e.g. if you have time, look at the memory usage of a typical Symfony script.
- There are different goals in different software projects. Sometimes, the goal is to produce something maintainable and clean. Sometimes, however, there are existing systems that need to work together, or a PHP prototype that should be ported to Java, or a requirement for functionality that can be more easily and quickly satisfied with an existing PHP app.
- Personally, I spend a lot of time fiddling around with JSPs to try to get something that looks faintly the way I intended. I find PHP (generally) easier to use for presentation.
- Java, on the other hand, is much easier and better for back-end logic. Not only can you leverage excellent systems like Hibernate and Spring, as well as other bits like Apache FOP, Quartz scheduler etc., and native Java features like threads, but also strong typing allows for much better IDE support.
To support my arguments further (and hence this little article), I found a discussion about PHP and Java integration featuring IBM and the guy behind Resin. You can find it here.
Latest articles
- Google scores!
- Mandriva back in my top list
- The perils of package managers
- Why mix PHP and Java?
- An InputStream Iterator in Java
- Pagination in PHP or Java
- PHP and Java integration with Quercus
- Trying out Zend Studio for Eclipse
- Which framework for a new CMS?
- How to create a singleton in PHP
- A brief foray into MySQL Stored Procedures
- Sun VirtualBox vs. VMWare
- We're now a four computer household