The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Enterprise Web Applications: PHP vs. Java

In today's software, where so many applications are designed for the web, I often find myself trying to weigh the benefits and costs of using different languages. I am a Java developer, but I also have significant PHP/experience, and when it comes to web applications, it always seems to me that PHP is faster to develop and easier to maintain and configure vs using Java and other J2EE technologies (such as Spring or EJB3).

I've never really encountered scalability issues or had any real problems using PHP, so I'm wondering what I'm missing here. So many large web applications are developed in Java, and it always seems like configuration and maintenance are much more difficult. I realize that the n-tier architecture concept helps to separate code responsibilities and logic, but as more PHP frameworks emerge, I feel like you can do much of the same in PHP.

What are your thoughts on these languages?
Jeff Send private email
Saturday, May 12, 2007
 
 
IMO, the language (as long as it's something mainstream) is of lesser importance than the techniques used to build your scalable website.

Pick up a copy of Cal Henderson's book:
http://www.amazon.com/Building-Scalable-Web-Sites-applications/dp/0596102356
xampl Send private email
Saturday, May 12, 2007
 
 
I'd have to say that the language makes a huge difference in this case. I don't mean the syntax or libraries so much. But building a modern J2EE application is a much more complex process than building a PHP one.

As for stability, I couldn't really say. They both involve different challenges. Java can provide much more compile-time checking, so that can eliminate some bugs. You'll need to make up for that in PHP with self-discipline. But our company has done plenty of PHP and J2EE apps, and I haven't noticed any difference in stability.
JW
Saturday, May 12, 2007
 
 
That's a good point about the Java compile time checking, but you raise the point that I am most focused about the complexity of building a J2EE application. Would you say you spend less time fixing those PHP bugs than you do dealing with the complexities of developing and maintaining a J2EE app. If that is the case, why would you ever use Java for a large web app (obviously there are reasons people do, that's what I'm trying to get out of this discussion)?
Jeff Send private email
Saturday, May 12, 2007
 
 
The only times I've used Java for the front-end were when the client required it. I find PHP much faster to work in, because you can see your changes instantly, without a compilation step.
JW
Saturday, May 12, 2007
 
 
It all depends on how really "enterprise" your applications is - if you need to implement things like a distributed transaction to pull something from an MQ queue and update a database then J2EE is probably better for this than PHP.
Arethuza
Sunday, May 13, 2007
 
 
I appreciate the comments back. The more I started thinking about this when I was reading, I started thinking about what you just said, about how "enterprise" an application really is. I can see how for more advanced and safety critical applications, such as banking systems, why a Java system would probably work better. It seems like for more heavy-duty processing, where Java classes can be written to do computationally complex algorithms, Java would also be a better choice. Thanks again for your thoughts.
Jeff Send private email
Sunday, May 13, 2007
 
 
If you want the power of the Java language with the ease of deployment of PHP, why not try out C# and ASP.Net?

If you want to run on *nix, you can even use Apache with mod_mono.
Wayne B Send private email
Monday, May 14, 2007
 
 
Jeff:
"That's a good point about the Java compile time checking, but you raise the point that I am most focused about the complexity of building a J2EE application."

Why not just use servlets for the business logic and JSPs for the presentation? You get all the benefits of Java's compile-time type checking and runtime JIT optimization, without any of the miserable enterprise bullshit of J2EE.
BenjiSmith Send private email
Monday, May 14, 2007
 
 
+1 for BenjiSmith

This is exactly how we do it but we also throw in a little jstl so we have no code in the jsp. Works great and is easy to maintain.
TownDrunk
Tuesday, May 15, 2007
 
 
"Java can provide much more compile-time checking, so that can eliminate some bugs. You'll need to make up for that in PHP with self-discipline."

Do you mean type checking?

Do you think PHP being loosely typed tends to have more programming bugs?
C0D3r
Thursday, May 17, 2007
 
 
The PHP model is much simpler than the Servlet model.  Productivity in PHP seams higher - of course depends on the programmer. Maybe the Java Servlet model is good for big web applications, but I dont write big web applications. I'm learning Servlets at this moment and I'm thinking if I should go further than the course, but at this moment I would still choose PHP. The project we are doing on the course would have been much simpler using PHP.
SuperHeroHype
Thursday, May 17, 2007
 
 
I think it really depends on the programmers on your team, and what tradition they come from. Webby/unixy programmers are traditionally pragmatic, a little sloppy, extremely rapid developers. They do well with a PHP front-end/PHP back-end architecture (or something newer like ruby.) Programmers that think of themselves as "computer scientists" or logicians find PHP too sloppy, and tend towards "cleaner" platforms like Java or C#. It's just another religious war.

My last system was a web-scale app that used PHP on the front end, Java on the back end, and a proprietary communications mechanism between them. It worked pretty well, and the team was very productive. But the reason for using Java on the app-tier instead of PHP was just religious -- my manager just didn't trust PHP.

I'm currently working on an ASP.NET front-end/C# back-end system. C# has actually been very effective on the app tier. However, ASP.NET is so complex that the productivity just hasn't been there. I long for the sloppiness and productivity of PHP.
Vineelio Send private email
Thursday, June 07, 2007
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz