Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Re: PHP vs. JSP (http://www.velocityreviews.com/forums/t125859-re-php-vs-jsp.html)

Wojtek 08-21-2003 03:31 AM

Re: PHP vs. JSP
 
On Wed, 20 Aug 2003 21:32:19 -0400, "John MacIntyre"
<Please@reply.to.group.thx> wrote:

>Hi,
>
>I am planning to move my web page onto a Linux server and will need to
>rewrite my sites from ASP.
>
>I am at a crossroads on whether I should chose PHP or JSP. Or possibly even
>something else.


>Any input on each technology, or where I could find a non-biased comparison
>would be greatly appreciated. Since, what ever I go with, I will probably
>be sticking with for the next few years.


ASP, PHP, and JSP are all intended to mix code with HTML.

So ASP has HTML and Visual Basic code, JSP has HTML and Java code, and
PHP has HTML and PHP code. All use some form of <% %> to contain the
code.

However, PHP can also be a standalone program with NO HTML, which is
why it can be run from the command line, just like Java and Visual
Basic.

I have coded quite a bit in both PHP and JSP/Java. Both use a C like
syntax.

PHP is always interpreted (you CAN get PHP compilers, but you will
need a special server process to run them). JSP's are compiled, and in
fact become part of the Web application binary code.

PHP is OK for small projects. By small I mean less complex, not fewer
pages. The reason for this is that if you try to create a framework
for your Web application, the amount of time it takes the PHP
interpreter to process the frame work will swamp out the time it take
for a particular page to run. For instance, in one of my trials, it
took over 85% of the loading time of a page just to process the
framework. Remember, PHP code is NOT resident in memory, so EVERY
application service you need must be interpreted for EVERY page hit.

On the other hand, a JSP page is usually run as part of an
application. The application server loads the framework and holds it
in memory. Then as each page request come through, the code for that
page has all the framework resources available to it.

So if you do multi-language sites, PHP must load the langauge specific
text for each page hit (possibly loaded from a database - which
happens for each page hit), while JSP/Java already has it resident in
memory as a resource object (possibly loaded from a database during
application startup - which happens once).

PHP is not object oriented. Yes it has classes, but the implementation
breaks a LOT of OOD concepts. It is more like the OO in Visual Basic.


All that having been said, I prefer PHP for quick Web sites, and
JSP/Java for more complex sites.
------------------------
Wojtek Bok
Solution Developer

John MacIntyre 08-22-2003 01:34 AM

Re: PHP vs. JSP
 
"Wojtek" <su-news@bossi.com> wrote in message
news:0ud8kvorr1l810a1uqj9q1pvfjsk67bha8@4ax.com...
> On the other hand, a JSP page is usually run as part of an
> application. The application server loads the framework and holds it
> in memory. Then as each page request come through, the code for that
> page has all the framework resources available to it.
>
> So if you do multi-language sites, PHP must load the langauge specific
> text for each page hit (possibly loaded from a database - which
> happens for each page hit), while JSP/Java already has it resident in
> memory as a resource object (possibly loaded from a database during
> application startup - which happens once).
>


Thanks Wojtek,

JSP sounds to me like the way to go, but it sounds like JSP more resource
intensive.

Is JSP a resource hog?

Thanks again,
John MacIntyre




Roedy Green 08-22-2003 10:35 PM

Re: PHP vs. JSP
 
On Fri, 22 Aug 2003 21:02:13 GMT, Wojtek <su-news@bossi.com> wrote or
quoted :

>If you change a JSP file, then the server will automatically compile
>it. So the first user to hit that page will suffer a slight delay, but
>all subsequent users will not. Or you can pre-compile the JSP.


The key point to understand is the JSP page is NOT compiled on every
request!

The other point is that you can change the JSP code on the fly without
taking down the server, or can you?



--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Randall R Schulz 08-22-2003 11:31 PM

Re: PHP vs. JSP
 
Roedy,

Roedy Green wrote:

> On Fri, 22 Aug 2003 21:02:13 GMT, Wojtek <su-news@bossi.com> wrote
> or quoted :
>
>
>> If you change a JSP file, then the server will automatically
>> compile it. So the first user to hit that page will suffer a
>> slight delay, but all subsequent users will not. Or you can
>> pre-compile the JSP.

>
>
> The key point to understand is the JSP page is NOT compiled on
> every request!
>
> The other point is that you can change the JSP code on the fly
> without taking down the server, or can you?


You can. At least on the reference implementation, Tomcat. I believe
it's commonly supported, if not mandated by the spec, but I'm too lazy
to look it up right now.

Randall Schulz

> Canadian Mind Products, Roedy Green.




All times are GMT. The time now is 02:56 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.