Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Perl and Java's place in the Universe (and my resume)

by husker (Chaplain)
on Jun 28, 2000 at 23:54 UTC ( #20243=perlmeditation: print w/ replies, xml ) Need Help??

Can someone familiar with both Perl and Java comment on their virtues and vices w/respect to one another? I am just starting out on my own path of Perl enlightenment, and I don't have background in Java at all. I see plenty of job ads for Java skills, but relatively few for Perl. Having recently come of the opinion (reinforced by the wisdom accessible here at perlmonks) that there isn't much you cannot do with Perl, why does Java get the mindshare it does? Are there really things that you can only do (or only do *well*) with Java? Both Perl and Java are, basically, "interpreted" languages. (I know ... there are plenty of Java compilers ... but that really isn't in the spec of the language ... compilers are the leather seating option). Both Perl and Java applications run on a variety of platforms, with little or no change to the underlying source code. So what's the advantage? For whom? Is there an advantage of one over the other? My ignorance of both may be preventing me from seeing the essence of the difference .. I humbly ask to be enlightened.

Comment on Perl and Java's place in the Universe (and my resume)
Download Code
RE: Perl and Java's place in the Universe (and my resume)
by Anonymous Monk on Jun 29, 2000 at 01:20 UTC
    Having worked with both I can tell you that they are both truly useful languages. If you have the opportunity you should get to know them both. The main reason Java gets the vast majority of the mindshare in my opinion is that it was designed for the Internet and the new push in distributed computing, and it is Object Oriented in nature which is the current defacto trend in design methodology. Java also is very easy for C++ programmers to pick up since it's so similiar which is another reason it is so popular. Perl's strengths as far as I'm concerned are it's comprehensive regular expression engine, it's string manipulation and formatting abilities and it's brief syntax which allows you to quickly hack something together that needed to be done yesterday. That is why sysadmins love it so much because it lends itself so well to "throwaway" code and ad-hoc solutions. Another benefit is the community that has grown around this language and the vast amounts of modules that have been designed to do anything and everything. Perl's weaknesses in my opinion (others would argue that these are strengths, but when applied to scalable enterprise systems they cease to be amusing) are its less-than intuitive syntax, its lack of typecasting, its lack of a coherent thread model (I realize that there is a threads package but it is an add on, and is not part of the standard source), and its lack of support for certain object oriented semantics (such as templatized data types, true inheritance, exception handling, enforceable data encapsulation, and abstraction for example). Perl folks would argue that Perl has all these things but they are not enforced...and the object model requires a lot more overhead than Java. As a system gets more complex these things tend to start stacking up and Perl objects become a tangled mess. Java on the other hand is very strong in the Object Oriented department...it supports a true Object model and has the ability to implement inheritance, encapsulation, etc. Like Perl it has a very strong community and lots of add on packages, many available for free as well. It has a simple threading model, and great facilities for internet applications (applets, which are more powerful than CGI in my opinion, as well as servlets, etc.) JavaBeans allow you to build reusable components that can be dropped in as building blocks to other applications. One of the other strengths is its distributable nature, there are a large number of CORBA orbs with built in Java support, while I believe only MICO has Perl support. Another issue is the fact that I find Java debugging easier to do than Perl due to Perl's lack of typedef. For me personally, in a professional setting I like to do the "core" of the system in Java or C++ because they are easier to clean up/maintain in my opinion and then write "glue" applications/scripts in Perl (things such as file parsers, cleanup scripts, and system monitors and system loggers) since these tend to change rapidly be needed right away and assist development.
      The above AM post is one of the best Anonymous posts on this site. The author understands that each tool has it's strengths and weaknesses, including Perl. My recommendation for language learning is to not limit yourself. Learn as much as you can. Java has its place, as do Perl and C++.

      TIMTOWTDI

      I normally don't vote one way or the other on AM Posts, but this was very well written and straightforward.
      Very well done!

      Update: Whoever voted this -- please explain why. Just curious. Thanks!
(jcwren) RE: Perl and Java's place in the Universe (and my resume)
by jcwren (Prior) on Jun 29, 2000 at 03:05 UTC
    The AM post is a very well spoken post.

    One of the things that s/he didn't address, however, was the target. In the context of a backend web processing, Perl is used far more than Java. In fact, I don't know of anyone *myself* that has used Java for CGI type purposes.

    Java, however, has one particular strength that Perl will never be able to address, and that's client side processing. Java allows you to manage graphics rendering, form validation, sockets connections, etc all on the client side. An example might be a client/server process where the server supplies a continuous stream of data to the client to be displayed as a gas gauge, representing the current number of processes running on the server (as to why this is useful, we'll just skip over). With Perl, the best you could hope to do is client-side pull, updating the form every so often. With a Java application, you could update as fast as your link supports (maybe 100-200 times a second).

    Similiarly, if you have form data that's algorithmically generated, Java can do this for you. An example of that might be doing loan calculations, where the user enters the number of payments, the loan amount, etc, and calulcates payments. You *could* do this by re-submitting the form to the server everytime a user makes changes, but you take unnecessary server hits, and delay feedback to the user unnecessarily.

    I've seen a growing number of standalone applications that are written in Java, such as book managers, CD managers, etc. They're pretty slick. Unfortunately, like Perl, they require the user to have software already installed in the machine to run them (typically the Sun JDK environment, or MS-Java). At the moment, this is what I'd consider one of Perls weakest points. If you're an NT user, or running on a poorly managed *nix box, you might not be able to run either the Perl application or the Java application. For this reason, I'm a big fan of web driven apps, where you, as the author, have control over the environment. Java applications written for a web browsers can be somewhat browser dependent, especially if you start getting a little funky. But, conversely, any classes the user needs to run the application get pushed to his/her machine at run time.

    Knowing both Perl and Java give you an extremely powerful toolkit. There are those that pooh-pooh Java saying it doesn't have a place. They're just basically un-informed, and should be ignored. There are some jobs best (or easiest) done server-side, and some jobs that are best done client-side. Being able to recognize the difference, and knowing what tools to use (and how) is what gives you the ability to solve problems, impress your friends, and command awesome incomes. (Well, usually the first two, at any rate.)

    Java, like Perl, is pretty much here to stay. There will be other technologies to come down the road, but the fact is that learning both of these is not going to be a mistake. Not to mention, the more languages you learn, the easier it is to pick up new ones. After a little bit, you can basically glance through a reference for a new langauge, and understand how to use it (you may not be able to exploit it to it's fullest potential, but you'll be able to do what you need to do. Which is the goal.)

    --Chris

    P.S. Skip learning COBOL, it's dead.
      In regards to using Java for backend. I have, and it was/is horrible. Just as a fair warning, don't do it, Java has it's place, and it isn't there.
RE: Perl and Java's place in the Universe (and my resume)
by chromatic (Archbishop) on Jun 29, 2000 at 04:03 UTC
    One thing I do miss about Java is the threading model... if Perl's threads were better, it would make some of my programming tasks easier. (fork and shared memory don't really cut it, and named pipes or local sockets aren't as nice).

    Another thing easier about Java is that most people have some sort of JVM installed, at least in their web browsers. Yes, there are a lot of differences between the three major variants, but if someone has a modern version of Windows installed, they have Java.

    GUI programming... it's a wash, either way. Perl's nicer in some ways, depending on your widget set, while Java has more widgets built in.

    I'm a whole lot more productive in Perl, though, and I'm a better programmer for learning it. If you have the time to learn both, you'll benefit.

RE: Perl and Java's place in the Universe (and my resume)
by royalanjr (Chaplain) on Jun 29, 2000 at 20:11 UTC

    This is a wonderful thread!! This type of material is the reason I come here. Great posts, everyone.

    Roy Alan

    Drunkard of Borg: "Resultance is floor tile."

RE: Perl and Java's place in the Universe (and my resume)
by JanneVee (Friar) on Jun 30, 2000 at 02:39 UTC
    I have a previous post about this from a little different view. I just got one thing to say. It is very important to ask the questions you ask! To know the strenghts and weaknesses of languages is very important to know, so you know when to choose a particular language.

    Everything that is Text handling. Everything handling large amounts of data(mainly PDL). My favorite choice is Perl. Drawbacks. I just can't get my head around to a natural way of handling "events" in perl!

    (IMHO)The only thing that Java is good at is forcing one to think OO. i.e. I like to handle graphics, sockets, threads with Java. It gets easier to think of things mentioned as objects. It has atleast made my life easier to grasp the concepts.

RE: Perl and Java's place in the Universe (and my resume)
by mrmick (Curate) on Jul 03, 2000 at 18:10 UTC
    I saw this post and the responses it generated. This thread has turned out to be the most interesting one I have found so far (although I haven't been with PerlMonks for very long). I found myself compelled to vote for both the original post and the reply by AM.
    This is one of the reasons I decided to join the group. Keep it up!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://20243]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2014-08-22 00:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (144 votes), past polls