I've been thinking about this quite a bit recently.

I agree with Gunther-- what is more important is not really the language
that you use, but the high-level application framework you have built for
yourself and how you use it. This is because most of the essential elements
of any framework can be duplicated in any reasonably powerful programming
language (mod_perl, java, tcl, even VBScript/VB to some extent).

That said, my own experience and benchmarking showed that mod_perl is the
best of these architectures for building extremely high-quality, reliable,
_complicated_ 3-tier Internet applications in which the prototyping and
release cycle are very highly compressed, because I can write the most
high-quality, high-speed code per unit time in Perl. By 3-tier apps, I mean
apps consisting of a browser, the app server (mod_perl), and an RDBMS.

Perl doesn't have much support in the way of n-tier apps, which is why I
find Nathan's question interesting, and why I have been thinking about it
recently. From some recent experiences with using SOAP to integrate with an
outside vendor, I believe that it is possible to create a best-of-breed
n-tier solution using Perl as the glue layer. For those of you who don't
know what SOAP is, it's essentially RPC over XML, and allows any app to talk
to any other app in a standard, XML-based format. Go to
http://www.soaplite.com for a very clean implementation of SOAP for Perl.

To continue-- there are a few reasons that you might want to use Java as a
component of a mod_perl app:
-There are sometimes pre-written components for Java that you'd like to use
because a vendor has written pre-specified hooks for Java. This could also
be the case in which you have to integrate with any legacy systems.
-Java has much better support for threading, and therefore in many cases
makes a much better server (the simple example for this is a chat server).
-Because of Java's threads, it can pool transactions resources (e.g.
databases) better, and may therefore be more efficient in places where
resources are tightly constrained, _especially_ if the database is queried
relatively infrequently.

For similar reasons, you might want to use a VB component in your
application, etc. SOAP makes that possible.

The point here is that I think that an awful lot of folks out there have
straitjacketed themselves into thinking that if there's a complicated
problem that needs to be solved, and there's a piece of that problem is best
done in Java, then we ought to write the whole thing in Java. What I'm
saying is that that's not necessarily true-- that it's actually possible to
write best-of-breed solutions by introducing a communications-layer
abstraction that enables you to build a clean n-tier architecture. CORBA
promised this, but was sufficently difficult to implement because it has not
(to my knowledge) gained very wide acceptance in the Perl community. Also,
the major ORBs (IONA, Visigenic) have largely overlooked creating Perl
bindings for theri apps. SOAP, however, makes distributed computing
extremely easy and _very_ clean, and I think that it could change the way
that people think about building complicated, high-quality applications in
an extremely compressed timecycle.

Using SOAP actually opens a number of other possibilities that don't require
thinking outside of mod_perl, too. For example, one of the big selling
points of Java is that it allows horizontal partitioning of classes on
different machines. Using SOAP, you can actually partition your _perl_ logic
so that different pieces run on different machines; or, you can write a
component in Perl that is subsequently called by a Java component.

OK, enough of my rambling...

cheers,
Ed

-----Original Message-----
From: Gunther Birznieks [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 12, 2000 11:42 PM
To: Chris Winters; Nathan Torkington
Cc: [EMAIL PROTECTED]
Subject: Re: Article idea: mod_perl + JSP


At 11:11 PM 12/12/2000 -0500, Chris Winters wrote:
>* Nathan Torkington ([EMAIL PROTECTED]) [001212 22:09]:
> >
> > Anyone run such an installation?  Anyone want to write about their
> > setup and experiences?
> >

There are projects where we use mod_perl handlers for stuff like
prototyping auth but then use servlets/JSPs for the app. But I believe
that's too shallow for what Nat wants.

We're a small shop of primarily fairly senior developers (at least several
years experience in the languages we like to use)... and we've actually
found that the Java web and the Perl web projects we've delivered on aren't
necessarily THAT far off in project delivery time than some Perl people
would have you believe.

Of course, we have a toolkit that we use to develop apps in both Perl and
Java which helps, but it's still interesting that business logic for people
experienced in the language of their choice isn't that bad in terms of
delivery time. Of course, maintenance is another issue.

I'll probably get some flak for the above statement about Perl vs Java
delivery time. :)


>Kind of off-topic but not really: I've recently moved from a job with
>100% Perl to one with 80% Java / 20% Perl. One of the things I miss
>most is the Template Toolkit. (There are lots of other things too, but
>this keeps coming up again and again.) TT is just so amazingly useful
>and simple enough that I can't believe more people aren't using it.
>
>As for Java, I find it really hard to believe that JSP has caught on
>like it has. The syntax is *amazingly* clunky and leads me to believe
>that most people who write JSP use WYSIWYG editors to generate the
>code for them. (Not that there's anything wrong with that, but it gets
>my hackles up that catering to one group of folks raises the barriers
>for another.)
>
>"Clunky syntax" might seem like a trivial concern, but IMO it's
>not. It goes right to the heart of usability -- JSP does not make easy
>things easy. Since you can embed Java into the page, hard things are
>possible, but the wisdom of doing a lot of processing in the page
>itself is beyond me.
Ah but have you looked at taglibs? We rarely ever put Java processing on
the page itself.

In the history of open source java apps we've developed there was only one
algorithm that we chose to kludge in as embedded Java code (and we will
eventually remove it)... And it was an algorithm to generate event blocks
in the day view of a calendar (ala Outlook) so that multiple appointments
can be at the same time but also span different hours (so 3pm to 5pm and
another from 3:30pm to 4:00pm) etc.. and the calendar knows how to render
itself. Believe me that is a HARD algorithm in any language to get right so
that the HTML displays nicely in all browsers.

As for logic in a JSP... Well, the above is an example of something where
you need code for the display to work well.

The downside of taglibs is that they are complex, however taglibs aren't
THAT bad. In our framework every JSP page has at least 3 sets of taglibs
(more can be added if they are generic and serve a purpose)..

Framework level -- These are our utility taglibs.
App level -- These are taglibs that represent app information
Page level -- Each JSP page, like it or not, has information that it needs
to display specific to itself.

The nice thing is that our web designer just needs a cheatsheet of taglib
and what it does and doesn't have to worry about any other syntax.

The main bad thing about this is that when we spec out a project, each
"view" on the application we spec out as 2 days instead of 1 day of work in
the equivalent Perl because coding the taglibs gets to be a pain.

This may seem like overall project delivery time is increased, and it is...
a bit. But the majority of a webapp is not necessarily the screens. It's
the logic underneath, so our timelines don't really end up growing that
much in the scheme of a project.

But we do get a better maintenance time because the JSPs are really
divorced entirely from Java code allowing a web designer to change things
at will without having to worry about an artificial . We almost never embed
Java inside a JSP.

>(And generating web-interfaces from servlets is sufficiently painful
>that we don't need to discuss it -- haven't any of these smart Java
>people ever heard of heredocs?)

There are preprocessors that help with this. But of course, you have to
always remember to compile step to include the preprocessor. And then you
still have the issue of variable interpolation.. Another thing annoying not
to have. :)

>In fact, entirely separate frameworks -- from the open source world
>there's WebMacro (www.webmacro.org) and the WebMacro spin-off Velocity
>project (jakarta.apache.org/velocity/), among others -- have sprung up
>to address JSP's deficiencies.
>
>But JSP has hooks in various editors (notably Dreamweaver) and has big
>money (Sun, Oracle, IBM...) behind it. Plus it has a published
>standard and (despite its syntax) is quite extensible.

I agree. It is quite extensible. We racked our heads long and hard last
June when we started full-on development of open source Java apps as to
which toolkit to use. In the end, WebMacro and the others have really not
caught on in a huge way. JSPs are what a lot of developers we interview
these days do know. So it was easier for us to go with the "standard".

However, keep in mind that JSPs are one part of a generic web application.
There's still authentication, logging, datasource manipulation, session
mgmt, resource locking, handling incoming data (form validation, untaint,
transformation), having a framework to implement model,view,controller (eg
struts project for Servlets/JSP), etc...

These are the things we spent a lot of up front time developing in Perl and
then spent 2 man-months porting to Java. And in the end, having this
toolkit has allowed us to focus on business logic and look-and-feel which
is what makes one project different from every other project.

Having a solid architecture also helps. It took us 7 years of coding web
apps in Perl, and then one and a half years of solid work on the latest
Perl architecture we have. When I say it took us 2 man months to port the
basic Perl stuff to Java, its not because Java was easier to code but
because we had already discussed the design decisions to death and
experimented and made the mistakes already.

A well-specified app is always easier to code regardless of Java or Perl.
Over the years I've become more of a fan of seeing the benefits of good
software engineering than really thinking a particular language is a silver
bullet.

With that said though, I still love Perl.

Reply via email to