Re: PHP vs. JSP
| From: | Mark A Mucha | Date: | Mon, 31 Jul 2000 02:56:07 +0000 |
| Subject: | Re: PHP vs. JSP | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-9102@lists.php.net to get a copy of this message | ||
Ummm...
If you know what you are doing........you wouldn't have null pointer
exceptions in you jsp scripts :O)
For big projects, java would be quicker to develop........for most web
apps......PHP does just fine ;O)
""Keith Devens"" <php@keithdevens.com> wrote in message
news:NEBBLNLBAMDEBJCJGNBIAEJECCAA.php@keithdevens.com...
> Alright, I was afraid someone would ask <g>
>
> By the way, what's the best way to reply and send a message to the list?
> Another mailing list I'm on just lets me reply to a message and it goes to
> the list. What's the right way to do it for this list? "Reply to all"?
>
> Alright, with that out of the way, here is my list of "Bad Thing"s about
> JSP.
>
> 1. First, I'll reiterate Zeev's point.
>
> "Simply put, Java isn't, and was never meant to be a rapid development
> language. It's not a scripting language. That is, in my opinion, JSP's
> biggest flaw."
>
> Variables don't autovivify, you don't have good string handling (yes, Sun
> has a regular expressions library *somewhere* that you can use, although I
> don't think it's even included with the product I was using for JSP. In
> other words, it's likely to not be available, and it's certainly not built
> in), and you don't have dollar sign variables to include in strings. Oh
> yeah, and forget an easy e-mail function. You'd be amazed at what you need
> to do to get the same functionality as PHP's mail() function in JSP.
>
> 2. Development is just a pain in the butt for many reasons. The number one
> pain in the butt is null pointers. In JSP, if you get a null pointer,
that's
> it. There's no help whatsoever. It gives you a stack trace, and you have
no
> clue where you got the null pointer, how much of the HTML it got through
> before you ran into the error, or anything useful. It's a huge pain. By
> contrast, PHP will output everything up to where you got the error, give
you
> a useful error message, and keep going. In JSP, when you get a null
pointer,
> a lot of times you just have no clue where to start looking. This brings
me
> to the next problem...
>
> 3. JSP is compiled. The thing is that the JSP itself isn't compiled into
> Java bytecode. It's precompiled into a servlet first, and then that
servlet
> is compiled. This has a bunch of ramifications. One, when you get an error
> like the one I described above, if you're lucky enough to get any hint at
a
> line number where the problem might be, it's not the line number in the
JSP
> file, it's the line number in the servlet source!! Then you have to go to
> the directory where the intermediate servlet of the JSP is stored, and
find
> the line number the error was on.
>
> 4. Also, the precompilation is one more error prone step for the whole
> process to go through. Sometimes it just doesn't compile the JSP into the
> servlet right. I've had at least one time when I've been sure that the
> precompiler was breaking my code.
>
> 4a. I almost forgot this, and went back and added this at the end.
Whenever
> you do an include in JSP, it sucks the include into the servlet source and
> then compiles the whole thing. The thing is that if you change your
include,
> the base file's modification date doesn't change, so the server doesn't
know
> to recompile your JSP the next time it runs. If you change an include, you
> wind up having to reupload every single file that uses the include so that
> the file modification date changes and it gets recompiled to use the new
> include. Needless to say this is really annoying.
>
> 5. Implicit objects, or "You can't write functions!": JSP gives you a
bunch
> of "implicit objects", such as "out" which lets you print to the browser,
> and "request" which lets you get get and post parameters. The thing is
that
> no function (method) you create has access to these. This makes it a pain
in
> the butt to write functions, in practice, and you wind up with huge
> monolithic code. I can explain the stupid technical reasons why this
> happens, and it involves, again, the precompilation into a servlet, but
it's
> not worth going into detail.
>
> 6. The documentation is fairly poor. Also, with PHP you pretty much just
> learn PHP. With JSP you have to know Java first, then you can learn JSP.
>
> 7. Just some practical, ease of use considerations. When you want to do an
> "if", the majority of the time you can just say if($variable == "string
you
> want"){...}. It doesn't matter whether the variable was ever set before.
In
> Java (I'm thankful you can even do this at all, thanks to Java having
short
> circuiting logical operators), you have to do things like if(variable !=
> null && variable.equalTo("blah")){...} ALL the time. Also, with string
> parsing, I wound up using the StringTokenizer for most things, rather than
> just doing an explode(), for instance.
>
> I'm not sure I did the best job of explaining the points, and it feels
like
> there were more bad things involving JSP that I can't remember now. In any
> case, be happy you use PHP. Unfortunately, it seems like JSP is growing in
> usage, when it doesn't deserve to given the obvious 1.x quality that it
has.
> To close, the one good thing JSP has going for it is JDBC, although even
> that is arguably beaten by all of PHP's native db functions.
>
> Have a good day, all.
>
> Keith
>
> > -----Original Message-----
> > From: Ben Heuer [mailto:ben_heuer@artlover.com]
> > Sent: Saturday, July 29, 2000 8:46 PM
> > To: Keith Devens
> > Subject: RE: [PHP] PHP vs. JSP
> >
> >
> > HI Keith,
> >
> > Shoot...I share fully your dislike for JSP and Java for web development
at
> > the moment. But I'd really like to share your thoughts on WHY NOT JSP as
I
> > need to show it to the management types..?
> >
> > Thanks in advance!
> > Ben
> >
> >
> > -----Original Message-----
> > From: Keith Devens [mailto:php@keithdevens.com]
> > Sent: Sunday, July 30, 2000 12:17 AM
> > To: php-general@lists.php.net
> > Subject: RE: [PHP] PHP vs. JSP
> >
> >
> > I sent this message yesterday. I'm new to the list and didn't realize
that
> > the list address isn't the REPLY-To address, so I would up sending it
just
> > to one person :)
> > -----------------------------------------------------
> >
> > JSP, in my opinion, is just NOT a viable language at this point. I've
done
> > kind of a lot of work with it, unfortunately, and it's really not
> > ready for
> > prime time. Also, Java just isn't a good HTML embedded scripting
language.
> > Who wants to worry about null pointers (sorry, references) in
> > their HTML? In
> > any case, I can't say enough bad things about JSP. I won't go into it
now,
> > but if anyone really wants to know, feel free and I can give a
> > whole list of
> > reasons why JSP is a "Bad Thing".
> >
> > Keith
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>