I came across open-source project PHP/javaBridge for connecting php application with java. But why should I use java with php? Is there any specific advantage for this? Thanks, Robert
+4
A:
The main benefit is when you already have a lot of existing java libraries that you don't want to recode in PHP, but where you do want to build new applications using PHP
Mark Baker
2010-08-12 11:07:09
is there any other benefit like.. speed of execution or something, when using java?
robert
2010-08-12 11:08:29
Actually, I'd argue that it would be slower using the bridge. The reason is that for most tasks, java won't be THAT much faster. And you're going to lose a lot in the bridge (well, maybe not a lot, but I think enough to wipe out any possible performance gain for most tasks)...
ircmaxell
2010-08-12 11:09:46
ok.. thanks for that comment.
robert
2010-08-12 11:11:08
Performance-wise, it would probably be slower... but if you've already spent months developing and debugging a library in java, then there's a definite speed benefit in the development/testing cycle that could be significantly more important than a few milliseconds slower execution time
Mark Baker
2010-08-12 11:19:58
Oh, I'm not saying there aren't benefits to using the bridge. I'm just saying that raw speed likely isn't one. If you have a lot of code already in Java, then use the solution that lets you re-use all (or as much as possible) of that code...
ircmaxell
2010-08-12 22:25:31
A:
Do you really need to use Java? If so, go for it. Or are you just looking for new ways to do things? If so, don't bother. PHP is powerful enough to do what you need. So is Java. Pick one, and stick with it...
ircmaxell
2010-08-12 11:07:54
i don't really need to use java with php.. as you mentioned just looking for new ways of doing things..
robert
2010-08-12 11:10:20
+2
A:
You wanna find the right tool for the job, not the right job for the tool. I guess you just shouldn't use it if you have to ask this question.
That said, there are a few good cases where you'll use Java with PHP, most of the times the big advantage is that the Java application keeps running on the background (as a daemon) and it's more powerful.
GuidoH
2010-08-12 11:37:05