[wplug] web programming

Pete Butler pete.butler at adelphia.net
Tue Oct 28 10:58:48 EST 2003


>There was a book review on slashdot earlier about EJB's and reading the 
>comments and other comments from the linked webpages I saw a lot of people 
>bash java for one reason or another. Granted, I've never done anything 
>with EJB's or J2EE, most people could very well be right on saying its a 
>horrible way to structure something. But at the same time, theres a lot of 
>people complaining about java, php, perl, and those ms languages in general.
>
>So if anyone here does or has done a great deal of web programming, I'd 
>really like to know your opinion on what you use and why. Personally, I've 
>used php, perl, and java and find pros and cons to all 3. While I use perl 
>everyday with basic system scripting, I've found it to be too much of a 
>hassle with making dynamic webpages. PHP is a much quicker and easier 
>solution to that. But I've found that the larger a project gets with PHP, 
>the more sloppy it gets too.. with having php code nested here and there 
>and stuff. I've found jsp and javabeans to be a good solution to that... 
>where you can take a block of code that was embedded in html, shove it in 
>a javabean, then use a tag to call the output. Makes everything much cleaner.
>
>But thats just my opinion... any takers?

Well, I can address some of that; I've never used PHP, but I've done plenty 
of Perl and Java.

It all depends on what you're trying to accomplish and what your 
environment is.

The Java web projects I've worked on were sizable, generally at least a 
dozen people.  (I had one project that was never more than four people, but 
it was managed so incompetently, I scarcely count it.)  For those projects, 
I thought Java was a very good choice, and cannot imagine doing them in Perl.

I found Java to be extremely well-documented and, once you get accustomed 
to the syntax, easy to use.  There's plenty of open source third-party 
tools of which you should avail yourself if you're using it.  A well-coded 
JSP is a thing of beauty.  While not a perfect implementation of 
object-oriented programing ("multiple inheritance" in Java is a total 
hack), I nonetheless found it pretty darn good.

It's also much easier to maintain a consistent coding style in Java than 
there it is in Perl.  Sure, you can code any language any number of ways, 
but in Java, the syntax always remains the same; you can always identify 
the building blocks somebody is using, even if they're being stacked in 
different ways.  Contrast this with Perl, where the very syntax of the 
language is a matter of personal taste.  In a team environment, Perl gives 
you not only enough rope to hang yourself, but hogtie all the team members 
on your way out.  Given the terseness that veteran Perl programmers 
typically prize, I would feel guilty about inflicting it on junior members 
of a team.

I'm also using Perl right now for a web application, and I cannot imagine 
using Java for the task.

Java is BIG.  And can be quite clumsy.  If you're organizing an 
enterprise-level web app using Java, you'll want to assign somebody 
full-time to environment issues; setting up the application server, setting 
up the EJB environment, making sure all the database connections are 
working efficiently, keeping you rANT deploy script as flexible as it needs 
to be, etc.  Whatever poor schmuck you assign will likely wind up feeling 
very overworked, at least in the early going.  Until the app server 
settings are optimized for what you're doing, be prepared for some 
unacceptably poor performance.

Java doesn't completely deserve its "low performance" rep, but an 
incautiously-designed EJB scheme can be an ungodly performance hog.  Note 
that I did NOT say "poorly" -- unless they've advanced the tech a bit since 
I last worked with them, there are things you can do with EJBs that LOOK 
like a good idea, SOUND like a good idea, and even work when you implement 
them, but bring the system to a bloody crawl when you ask them to deal with 
a sizable data set.  (Example:  Having an instance of an EJB represent a 
single row of data from a table can, if you following rigorously enough and 
use it on large enough data sets, be a staggeringly bad idea.  Unless, of 
course, they've corrected that problem.)

Perl development, on the other hand, is lightning fast.  When I want to 
test something, I upload the changed file to the test server and try 
it.  No recompilation, no bouncing the app server, none of that crap.  I'm 
also doing Perl development on a third-party server to which I do NOT have 
root access; the thought of trying that with Java makes me want to weep.

Perl is also THE choice for text or file processing.  Handling files in 
Java is, by comparison, very clumsy.  There ARE some worthwhile text 
processing classes for Java that you can download; these are a vast 
extension to Java's built in abilities, and make it almost kinda behave 
like Perl, under the right conditions.  'Nuff said.

And Perl, of course, also has more than its fair share of third-party open 
source extensions, thanks to the wonders of CPAN.  I find Java's to be, as 
a group, better-documented, but YMMV.

So, to recap:

Big project, lots of people?  Java.  (But, bear Perl in mind; might be a 
good choice for certain back-end tasks.)

Small project, not a lot of people?  Perl.

That's been my experience, anyway.

-- Pete Butler




More information about the wplug mailing list