[BNE-PM] What do you use Perl for?
Tony Obermeit
tonyob at compuserve.com
Tue Aug 20 00:01:51 CDT 2002
Derek, I appreciate your comments and questions. Please take my comments
as my perspective, I don't want to start a flame war....
At 02:28 PM 20/08/2002 +1000, Derek Thomson wrote:
>Tony Obermeit wrote:
>>My development is categorised in three areas, application development
>>(web/html applications with database (sql/oracle) back ends), build
>>scripts to support application development, ad-hoc scripts.
>
>The Perl DBI database integration is very good, indeed. And it comes with
>a command line tool that is sometimes superior to the one shipped with the
>product (I'm looking at you, Oracle :).
I agree that the perl dbi database integration is very good, it is one of
the compelling reasons to choose perl over other scripting languages for
shell scripting type of tasks.
>>Previously I used perl for all three of these areas, now I use java for
>>application development, ant for build scripts and perl for ad-hoc scripts.
>
>Okay, my question is: what technical reason is there for using Java for
>web applicatoins instead of Perl?
When using perl as a language for developing an application that will be
deployed to many sites, with a variety of configurations, I found perl to
be challenging. Some of the issues I had were:
(1) I didn't want to ship my source code. With java I am able to ship only
compiled .class files. This gives me a significantly higher level of
confidence that a bug hasn't occurred because someone hacked the source code.
(2) When I installed my perl scripts, I had to edit each script to replace
the path to the perl interpreter if the perl interpreter was installed in a
different directory to mine, particularly worse when trying to keep the
application working on unix and Windows NT/2k. This caused me concern in
regard to the installation of my application.
(3) I had challenges getting dbi/dbd::oracle working in a linux
environment, with java, jdbc just seemed to work in any environment.
(4) Ease of installation of a finished application, with perl I had
numerous scripts (.pl, .pm) to install. Java was much easier, I could ship
a single .jar file that included the entire compiled code of the
application, including the web server, the jdbc drivers and my application,
that made it easy to install the application, copy a single .jar file to a
directory and run with a single command java -jar jarfilename.jar. There
can be issues if the version of java on the target system is older than
what you expect but the same applies to perl.
Once I got in to java, I also found that much more design material was
available in regards to object oriented development than was available in
perl. Topics such as design patterns are well covered in a variety of java
books and white pages. Many examples of Model/View/Controller (MVC)
patterns are around in java, that didn't even seem to get discussed much in
the perl world. A topic associated with this is development methodologies,
the Agile Methodologies including Extreme Programming are well supported in
the java world with junit. I'd be interested to hear from others who have
used perl and Extreme Programming and what conclusions they have drawn from
the experience.
>I haven't ever done any web applications, so I really don't know, but my
>experience with Java is that it's large, slow, not very portable really,
>and the database integration support just doesn't measure up to Perl's DBI
>module, and it takes a *lot* more code to get anywhere.
Web applications are much different in java than non-web
applications. With non-web applications in java the java GUI is not
pretty, your comments below about java guis that are slow and large are
quite applicable). With web applications, java generates the html and the
performance isn't really an issue. One issue in perl's favour is that the
breadth of available libraries is much better and richer than java in
certain areas such as generation of png charts, etc. The newer versions of
java (many since 1999) are much better performance wise. The number of
api's being released with each version of java are staggering.
Having used DBI and JDBC extensively, I can't see where java's database
integration doesn't measure up to perl's dbi. They are both quite similar
to use. I haven't looked at how to do database connection pooling in dbi
but it is quite easy now in java with jdbc2. It can take more code in java
to get some things done in perl but the object orientation in java is
better than it was in perl.
I have found it easier to make java applications portable across
unix/Windows than perl.
>That was in 1999, maybe things have changed (but I still have to run Java
>GUIs that are too slow and suck up 46M!!). Is there any real advantage
>over, say Apache + mod_perl + Perl?
Overall, I would say the servlet api provides better capabilities than
Apache + mod_perl but I believe a dedicated perl developer can build just
as fast (if not faster) applications using perl with mod_perl. One
limitation with that is being tied to Apache. With the advent of a number
of pure java web servers, BEA, Orion, for example, being tied to apache can
be a limitation.
I would also say that part of my choice in using java over perl in
application development had to do with career goals. Java has become much
more the language of choice in the enterprise size of organisations
compared to perl. Organisations like IBM, Oracle, BEA, Borland and Sun
have made significant investment in java. For some, the fact that java is
not open source is an issue, my answer to that, choose perl if that bothers
you.
Perl is a really great language, it has many strengths, the same applies to
java, I continue to use both languages and encourage others to do the
same. The learning curve for me was significantly larger with java
compared to perl, yet I have several friends who took up perl on the basis
of my ravings about it and both of them struggled with learning perl. That
was hard for me to understand because I found perl extremely easy to learn.
cheers
Tony
More information about the Brisbane-pm
mailing list