Re: Why JSP is better than PHP >>
| From: | Zeev Suraski | Date: | Mon, 13 Nov 2000 20:12:10 +0000 |
| Subject: | Re: Why JSP is better than PHP >> | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-25023@lists.php.net to get a copy of this message | ||
At 18:46 13/11/2000, Erick Papadakis wrote:
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 trueAnything you can do in JSP, you can do in C++. The reverse is not true. So what? Use the right tool for the job.
2. JSP is much more powerful, since it has access to all the Java libraries. PHP only has access to PHP librariesPHP has access to all of the PHP libraries, as well as all Java and COM objects. You would usually not need external Java/COM objects, though, because the Web development support that is built into PHP is quite extensive and extremely easy to use.
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.)I won't comment on this one :)
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 oneThat ought to be the worst excuse for a reason I've yet to see. Java is a *much* more complicated language than PHP is. Getting things done in PHP is usually much easier, and PHP requires minimal startup time. Of course, if you happen to already know Java, then JSP is easy. But it's kinda like saying that playing the 9th symphony is very very easy, but, yeah, it helps if you're already practicing piano for 12 years.
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 typingSounds like the wrong reason to me. No doubt, Java's object model is cleaner and much more powerful. But I wouldn't use a nuclear bomb to kill a mosquito.
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 completely wrong.
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.I'd argue that this isn't that important, and that you can do whatever you want using session variables, and you won't have to sweat while doing it either. Zeev -- Zeev Suraski <zeev@zend.com> CTO, Zend Technologies Ltd. http://www.zend.com/