Java's biggest strength is that its object system is probably the best of any commonly used language (i.e., one that is actually used, not just an academic oddity). The worst thing about Java is that it had better have a great object system, because you're going to be forced to use it no matter what.

Perl5's beggest weakness (IMHO), is that its object system is probably the worst of any commonly used language. It ain't pretty, but it gets the job done. It's not so bad for the applications programmers to use (what difference does it make if you say "$obj->foo()" instead of "obj.foo()"?), but it is an effort in kludginess for anyone developing new classes. Fortunatly, Perl doesn't force you to use its object system. You can write your program in a purely functional or procedural manner, too.

In fact, thanks to CPAN (probably the largest and best example of code reuse ever), many programs can rely on existing classes and therefore are so simple that anything but procedural just gets in the way.

For instance, I wrote CGI::Search for my current employer (who then graciously allowed it to be publically released) in order to simplify the many seperate search scripts on our web site. The example script shown in the synopsis for CGI::Search is a little over 100 lines and contains everything my employer needs for the vast majority of our searches. Most of those lines are just filling in data structures, and the exact size will depend on the complexity of the flat-file database that you're searching and the number of input parameters. Doing these scripts as anything but procedural is just taking up extra space without adding anything. In other words, the script itself is just a little glue to tie user input into an object.

I doubt Java will ever go the route where you can use it without declaring at least one class. It would be too much of a change from where it is now.

Keep in mind that although Java might be great for those really big problems, little problems tend to outnumber the big problems. Perl fills that space quite nicely.

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

Note: All code is untested, unless otherwise stated


In reply to Re: How would you fix Java? by hardburn
in thread How would you fix Java? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.