Re: PHP vs. jsp, advice please
| From: | SLanger at spirit21 dot de | Date: | Tue, 10 Jun 2003 08:26:14 +0000 |
| Subject: | Re: PHP vs. jsp, advice please | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-150861@lists.php.net to get a copy of this message | ||
Hello
Well here is my opinion on the two.
I think it is a lot easier to get an app ready and running with PHP
(especially database driven) than it is with JSP. The memory footprint of
PHP is a lot lower than with JSP. Alone the JVM that needs to be loaded
requires lots of resources. Also installing a Servletcontainer can be a
pain in the ____ but I don't think this is really a matter of choosing
between the two.
In PHP it is quite easy to programm fast and dirty but I find it hard to
programm clean easy to maintain code (mostly due to the typless nature of
the system, the inclusion of php code in HTML and the "per request
parsing"). This is supported with the lack of true object oriented
programming in PHP (at least IMHO) - this might be different with PHP 5 -
(NO FLAMES ON THIS!!!). JSP tends to force you to use a cleaner design
since you have to declare all your interfaces before hand. This does not
mean you can't programm dirty in JSP. Do to the memory model used in JSP
it is also easier to maintain session and request state since you have the
abitlity to access the different scopes (Application, Session, Request)
through a clean interface. Struts supports you in this by separating your
view from your logic in a clean managable fashion. If used in conjuction
with a generating tool struts is fairly easy and fast to use. ( I
recommend eclipse and a struts plugin like easy struts but this is just my
opinion) On the other hand the learning curve for JSP and Struts is a lot
higher than using PHP.
If you are using EJB in the backend (or other JAVA technologies) I think
it is easier if you go with JSP since you are staying in the same
programming paradigm although webservices should make it fairly easy to
connect PHP to an EJB.
Also i18n tends to be easier with Java than with PHP due to the builtin
UNICODE support.
One last thing in JSP you have the namespace advantage. In PHP large
applications tend to clutterup the global namespace and great care must be
taken to prevent variable redeclarations. But this is mainly a coding /
team issue. (Pear and their codingguidelnes might be a good resolution to
this problem)
JSP does add the threading issue which is not too apparent but can be a
real pain. But if you follow some guidlines it should not become an issue.
The fazit:
Can't really tell you this or that is better since I think you can built
largescale application in both. Depends on your preferences which one is
easier to use. All I can say OO is much better in JAVA than in PHP.
If you are using PHP I recommend using smarty as a templating engine and
building your own custom functions to have a clean separation of logic
and view.
Hope that helps a little
Stefan Langer