Tim Bray, Director of Web Technologies at Sun Microsystems, gave a presentation on comparing frameworks using Java, PHP, and Ruby. His analysis is pretty interesting, esp given that he’s a director at Sun.
Scaling – Tim acknowledges that PHP scales “well enough” compared to Java. He also goes further and says that PHP is easier to scale than Java. So, when we’re talking about using PHP in the enterprise, scaling is no longer a reason to not choose PHP.
Development Speed – It is possible to do “quick and dirty” with PHP. And even do “butt-ugly” code with it. But, I believe it’s also possible to write good code and do it fast with PHP. Basically that’s what my phramework is all about.
I think this is one of the fatal flows of J2EE. The development resources needed to develop J2EE apps is much more than developing in PHP.
Developer Tools – I don’t really think Java is the obvious winner here. I use Eclipse for both Java and PHP development, and I can pretty much do the same thing with both. Both have syntax highlighting, debugging capabilities, and version control. What Java does have though is code completion/navigation since it’s a compiled language. So, I would give Java an edge over PHP, but it’s not because of the tools, but because of the nature of the languages.
Maintainability – This is the only area on Tim’s slide that Java is better than PHP. But, I would say it’s about even.
The code syntax between Java and PHP is actually pretty similar. So, it’s not the code itself that makes it unmaintainable, but how the programmers writes the code. I’ve seen Java code where everything was written in a single JSP, making it unmaintainable. But, I’ve also seen the other extreme where the J2EE code was divided into 7+ layers and making it so complex that it would be a challange to maintain.
Another thing is that J2EE has a plethora of libraries to learn. So, if you need to maintain a project that uses Struts, Spring, EJB, and Hibernate, you’ll need to find a developer that has all these skillsets. And to find someone who does have this and is willing to maintain code is pretty rare.
Links:
Tim Bray: Java is less scalable than PHP – TheServerSide
Keynote of Tim Bray – thinkphp