Perl versus Java

This article is an opinionated comparison between the Perl and Java programming languages.

Full disclosure: I am biased towards Perl as I have been programming in Perl since January 1995 and am a Perl veteran. While working as a Perl Programmer at Accenture Federal Services, writing applications to process veteran's benefits for the VA, I raised the question – Why Java? Why not Perl?

In this article, I try to be as objective as possible, using practical considerations and engineering trade-offs.

Though I have contrasted Java specifically with Perl here, Ruby and Python could also stand in for Perl, as the same reasoning applies to those open source scripting languages.

Please remember to think for yourself, and do tell me what you think, so I may round out and balance the comparison. Let's make this article a useful technical resource for all.


Benefit

Perl helps the world at large, and is maintained in public by the community founded by Larry Wall.

Java pays Larry Ellison.

Winner: Perl


Merit

Perl became popular on its own merit, and gained wide commercial support later.

Java was hyped by corporate interests, namely Sun Microsystems, and Oracle Corp.

Winner: Perl


Cost

Perl is free of cost and requires no closed tools.

Java requires fancy IDEs and heavy tooling which cost money.

Winner: Perl


Adaptability

Perl is multi-paradigm, OOP optional, and fluid.

Java is hung up on OOP, and therefore rigid.

Winner: Perl


Intuitiveness

Perl is DWIM ( do what I mean ).

Java is tell-me-exactly-what-to-do-or-else.

Winner: Perl


Concision

Perl is concise and informal.

Java is verbose and formal.

Winner: Perl


Directness

In Perl, you get out of the car.

say "Hello from Perl";

In Java, you have to disembark the 4-wheeled automotive vehicle that your physical body is currently occupying.

public class MyHello {
       public static void main( String args[] ) {
       	      System.out.writeln("Hello from Java");
       }
}

Winner: Perl


Quality v/s Quantity

Perl requires finesse, which comes from a love of learning, experimenting, and creating.

Java was a commodity vocational skill for the masses.


Easy Names

In Perl, the variable name can be skipped. Perl knows you are referring to the default variable ( $_ ), so you need not spell it out by name.

$_ = "By Jove!";
say;

In Java, variable names are so monstrously long, that you need multiple wide monitors side-by-side, to be able to read them. German programmers are used to long words, and are usually emotionally reserved, but Java variable names cause them to fall to their knees and weep incontrollably, before rising up with steely rage and resolve, swearing to take California and improve it with German engineering.

Winner: Perl


Features

Perl and Java are largely equivalent, especially for a domain like server-side web application development.

Winner: -


Speed

Java VMs are faster than Perl.

Winner: Java


Lower error rate

Errors are directly proportional to the number of lines.

Winner: Perl


Higher Comprehension

Comprehension is inversely proportional to the number of lines.

Winner: Perl


Community

Perl is for hackers ( think Jedi ).

Java is for Business Application Developers ( think Stormtroopers ).


Project cost

Perl projects have low headcounts and therefore low management overheads.

Java projects have huge headcounts and require a lot of management, further adding to the project complexity and cost.

Winner: Perl


Speed of Delivery

Perl lets you whip up a working application fast.

Java projects take an order of magnitude more time to deliver.

Winner: Perl


Overall Software Engineering Soundness

Correct > Clear > Concise > Fast

Given two equivalent, correct programs, one in Perl and the other in Java,

Perl is clearer, and more concise than Java.

Java is faster than Perl, usually.

Winner: Perl


Longevity

Perl projects can be maintained long term, because the source code is public.

Java projects are tied to one company – Oracle. When ( not if ) Oracle goes out of business, as closed source vendors do, Java projects will be jeopardized.

Winner: Perl


Total Cost of Ownership

Given that the same project can be delivered much faster in Perl than in Java, the time-to-delivery factor far outweighs the runtime speed.

The cost of hardware keeps dropping, so the speed factor can easily be adjusted for, cost effectively.

Winner: Perl


Comparison:

Overall, Perl comes out a clear winner.

  1. With Perl, it is possible to deliver projects with a very small, skilled team, very rapidly, compared with Java.

  2. Projects developed in Perl can be maintained indefinitely as they are free of vendor lock-in, unlike Java.

divider

Prologue:

This is just why Accenture Federal Services uses Java instead of Perl. They want a project that has a huge head count, lots of middle management, and a 10 year development deadline. It means a lot more money from the government.

Furthermore, when Oracle shuts down, Accenture could go to the VA and ask for more money to rewrite the application in the latest closed source language.

A handful of skilled Perl hackers could deliver the same project much faster, and do a better job of it. And the project need never be rewritten.

Why Java? Why not Perl? Why Windows? Why not Debian Linux?

That would leave a lot more money to benefit Veterans directly, instead of lining Accenture executives pockets.

In fact, it makes sense to me to just crowdsource all the source repositories. Teach veterans about software, so they can help the VA spot bugs, while waiting for their benefits. Keeping all code out in the open, with the affected veterans watching, is a good way to stay honest. Publicly funded software should be...public.

Imagine teams of veterans battling bugs like Starship Troopers, learning new skills, getting paid, hanging out with a group of fellow veterans, doing work that matters to them, and whose requirements they understand well.

Ashwin Dixit