File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes J2EE vs PHP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "J2EE vs PHP" Watch "J2EE vs PHP" New topic
Author

J2EE vs PHP

Jeff Storey
Ranch Hand

Joined: Apr 07, 2007
Posts: 230
Hi, I've been a software developer for several years, primarily non web-based applications in Java. However, I have also spent a couple of years developing in PHP as a hobby. I've lately started to use Spring and I know that's pretty popular for J2EE web apps. But, what I'm wondering is what advantages does J2EE/jsp web development offer me over using PHP, especially now since PHP is object oriented with classes. The only thing I can really think of is that Java gives you the power of a strong language which could be good for some complex algorithms as opposed to PHP, but what else? Would it be possible (or advisable) to develop, say a banking web system, in PHP rather than J2EE? The development time is faster, maintainability is easier, and with frameworks we can separate MVC pretty easily. So why would I use J2EE technologies?

Thanks,
Jeff
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The development time is faster, maintainability is easier,

On what are basing these assertions?

I, personally, don't find this to be the case.
In fact, as the size and scope of a project grows, I find it much faster and easier to work with Java.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Jeff Storey
Ranch Hand

Joined: Apr 07, 2007
Posts: 230
Originally posted by Ben Souther:

On what are basing these assertions?


I'm basing these on experience. I've found that, especially with Spring, beandef files can start to get a little overwhelming and hard to maintain. But, putting this difference aside, do you have any other thoughts on my questions?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61218
    
  66

Originally posted by Ben Souther:
On what are basing these assertions?
Having developed both, i also wonder. I find the exact opposite to be true. php is a complete mess to deal with and things get unmaintainable very quickly. The on-page syntax is abhorrant. (JSP can be just as bad if you're not careful, but it's quite possivle to use JSP 2.0 as pure scriptless templates which are a joy to deal with).

Your use of Spring may explain much. Too many people fall into the trap of using the large , behemothic frameworks in order "to make development easier" and just find themselves in a hopeless morass.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jeff Storey
Ranch Hand

Joined: Apr 07, 2007
Posts: 230
Bear,

I actually read an article (I forget who the quote was from, but it was a respected J2EE community member) saying that it doesn't make sense to try and develop a J2EE web app without the use of Spring. Have you developed large scale apps without a framework? How did that work out?

Also though, assuming I like the maintainability and usability better of PHP, are there any real disadvantages or things I really can't do (maybe security or transaction related) with the latest versions of PHP?

Thanks,
Jeff
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61218
    
  66

Originally posted by Jeff Storey:
I actually read an article (I forget who the quote was from, but it was a respected J2EE community member) saying that it doesn't make sense to try and develop a J2EE web app without the use of Spring.
Everyone has an opinion. We evaluated Spring and then spent just as much time ripping it out. All we found that it did was to complicate things needlessly.

Apparently you are finding something similar?

Have you developed large scale apps without a framework? How did that work out?
Fabulously. And quite profitably, I might add (at least for my company if not myself).

Also though, assuming I like the maintainability and usability better of PHP
If it works for you, have at it. I find it painful.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Jeff Storey:


I'm basing these on experience. I've found that, especially with Spring, beandef files can start to get a little overwhelming and hard to maintain. But, putting this difference aside, do you have any other thoughts on my questions?


I've played with Spring but am not currently using in any of the projects on which I work.

Some of the things that I like about Java over PHP.
(I confess, I haven't worked with the most recent versions of PHP lately so some of these features may exist there now.)

In memory session handing.
Threading (Java makes this pretty easy).
The ability to add third party libraries to an application without having to compile them into the server or otherwise configure the server to use them.
Strong typing.
A compiler (starts out as a hassle but becomes a real friend when working on large projects).
Javadoc
try/catch blocks (last time I worked with PHP, you could only work with one bad statement using the @ operator.)

The Ubiquity of PHP/Mysql do make them the perfect choice for a really small, low budget projects (2 or 3 page apps that don't need to be maintained for long periods of time) but for anything more, JEE, for me, is much easier to work with and maintain.

PHP is like the Swiss Army knife of web development tools.
Small, fast, built specifically for the web, has most everything you need built in, and always there when you need it.
I wouldn't want to build a house with a Swiss Army knife though.
[ October 07, 2007: Message edited by: Ben Souther ]
Jeff Storey
Ranch Hand

Joined: Apr 07, 2007
Posts: 230
Ben,

You make some really good points there. I'm somewhat familiar with JSPs but haven't worked much with Spring in the webapp domain, and it looks really daunting. Maybe I'll just stick with no frameworks for now and ease my way into them. I appreciate your input. Thanks!

Jeff
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

There are more frameworks for JEE than you can shake a stick at and, from what I understand, there are quite a few emerging for PHP these days.

It's not really fair to make comparisons between the core technologies based on your experience with a particular framework.

I think your idea of working without one for a while, until you're comfortable with the core principals is a good one.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

Originally posted by Jeff Storey:
but what else? Would it be possible (or advisable) to develop, say a banking web system, in PHP rather than J2EE?

These folks would say yes as they host http://www.w2b.ru/OnlineBanking/index.php.

Originally posted by Jeff Storey:
that it doesn't make sense to try and develop a J2EE web app without the use of Spring. Have you developed large scale apps without a framework?

I suspect this person has a vested interest in Spring. There are many frameworks out there for Java. I've developed many J2EE web apps without Spring and it went just fine thank you.


Originally posted by Jeff Storey:
Have you developed large scale apps without a framework?

Without any framework or without Spring specifically? I did one without any framework (and just MVC.) This was somewhat more work than it needed to be. But it is certainly possible. And if I had done a second one at that company, there would have been more to build on. In fact, we likely would have pulled our common code into our own framework.

Originally posted by Jeff Storey:
are there any real disadvantages or things I really can't do (maybe security or transaction related) with the latest versions of PHP?

I haven't used PHP enough to know this, but I have a question: Does PHP allow you to define which users/roles have access to pages in an external configuration file? I know it is mainly page based. This doesn't imply or preclude the external files.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: J2EE vs PHP