FW: [PHP] Why JSP is better than PHP >>
| From: | Sander Pilon | Date: | Mon, 13 Nov 2000 18:37:35 +0000 |
| Subject: | FW: [PHP] Why JSP is better than PHP >> | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-25004@lists.php.net to get a copy of this message | ||
> Forgive me for a rehashed topic but the following has
> been thrust into my face by a guy who was born with
> Java skills and is still using the bloatware -
>
> -----------------
> Here is a list of reasons why JSP is better than PHP:
>
> 1. Anything you can do with PHP, you can do with JSP;
> the reverse is not true
Examples please!
> 2. JSP is much more powerful, since it has access to
> all the Java libraries. PHP only has access to PHP
> libraries
PEAR is underway, and a powerful language isn't defined by the number of
libraries that accompany it, it is (IMO) defined by how fast you can write
fast working code.
>
> 3. JSP is Object-Oriented, so leads to cleaner code
> that's easier to debug, maintain, and improve. (PHP
> also allows objects, but the object model is more
> primitive, and most scripted pages ignore PHP objects
> and just use normal variables.)
>
Most programmers, INCLUDING java programmers, wouldn't know decent OO design
even if they were standing on it. OO in the hands of OO-illiterate people
leads to terrible design and no reusability at all. In addition to that, the
procedural model is often faster and smaller - exactly what you want for
webpages.
> 4. The equivalent syntax in JSP is just as simple to
> learn, so you can get up and running just as quickly
> -- that is, there's no extra startup cost in using
> Java, at least not a significant one
>
This is not an arguement at all. You could say the same for PHP, since they
are 'just as simple'.
> 5. Java programmers (as opposed to 15-year-old hackers
> or HTML monkeys) appreciate the importance of a clean
> language with complex OO data structures and strong
> typing
>
Prejudicing people by the scripting language they use is just as dangerous
as classifying them by skincolor, religion or country of origin. I bet it
wouldn't be hard to find a java programmer more stupid than the average php
programmer.
> 6. With JSP, if the code inside a page gets too big,
> or if you want to use it elsewhere, you can cut it
> out, make it into a Java class, and invoke it from
> anywhere in your application (even not from a page).
> With PHP, you're stuck inside the HTML box.
>
That's the nature of a server-side script, this is no limitation.
> 7. JSP's concept of state management and persistence
> is more explicit and powerful than PHP's. With JSP,
> you can specify whether a variable persists for the
> page, the request, the session, or the application (or
> if it's just local to the function). The JSP engine
> automatically does the right thing with cookies so you
> have access to the variable on later requests. With
> PHP, you just have "global" and "not global", you
> don't have automatic session management, and have to
> do your state thing manually with cookies or hidden
> variables.
>
A minor thing, php4 has sessions, and a well working session library is made
in
a few hours, no big deal.
Really. PHP4 is fast, powerful, FREE, supported (by this list), and PHP in
the hands of a skilled PHP programmer is at least as dangerous as JSP in the
hands of a skilled JSP programmer. I bet 99% of the people out there never
used JSP or PHP to their full potentials, so the quality of both the JSP and
PHP code is directly related to the skill of the programmer, and has nothing
to do with the used language.
Your friend is obviously a JSP freak, fine. Let him use JSP, his JSP skills
are probably better than his PHP skills. But that doesn't make PHP a lesser
language. In fact, there's very little in the realm of webscripts that PHP
cannot handle just as well as JSP, and in the cases PHP cannot handle it,
perl or C(++) might be a better choice than JSP too.