Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: What is it about perl that makes perl so cool?

by BlueLines (Hermit)
on Dec 03, 2000 at 08:20 UTC ( [id://44624]=note: print w/replies, xml ) Need Help??


in reply to What is it about perl that makes perl so cool?

Hmm. What i dislike about java:

1) try / catch
I'm not the most experienced java programmer (a year or so while i was at school), but i really disliked having to check for errors from a method with two separate blocks of code. I disliked even more the fact that you had to know the specific exception that each method would throew. In java:
try { my block of code here} catch {the exact error here}
While you sometimes have to do this in perl (eval and check for $@), usually you can get away with something like this:
open (FOO, '/var/log/messages') or [die||warn||carp] "There was a prob +lem: $!\n";

2) my.method.name.is.so.extremely.long.that.i.get.a.headache.reading.the.code.that.i.wrote.
'Nuff said.

Things i did like:

1) The easy learning curve
. Java is not a difficult language to learn. Everything pretty much conforms to some basic standards, so once you get used to the way things work, you don't have to kick yourself trying to remember obscure things like whether or not you want the scalar or array return or whether or not $< or $> is what you're after. Java + Java Beans also make it simple (in comparison to everything except VB) to generate decent GUI apps, even for someone without much experience in such things.
2) Java is a true OO language
. As much as I love perl, i would never recommend it to someone as a first language. While it is indeed possible to do truly OO coding with perl, perl lends itself more to linear tasks. And if you're suddenly forced to start working in an OO environment, your screwed if all of your previous coding experience was in BASIC, C, and perl (i can vouch for this personally).

Don't get me wrong; I'm not bashing perl. The company i work for does 95% of it's coding in perl, and the speed that one can churn out good working code is amazing compared to any language. Alot of our employees have had no previous programming experience at all, and most have become competent programmers in a few months. I believe the same would hold true if we were working in java exclusively, although I would have never started if that was the case, since good java development environment != linux or freebsd. Anyhoo, sorry for the ramble.

BlueLines

Disclaimer: This post may contain inaccurate information, be habit forming, cause atomic warfare between peaceful countries, speed up male pattern baldness, interfere with your cable reception, exile you from certain third world countries, ruin your marriage, and generally spoil your day. No batteries included, no strings attached, your mileage may vary.

Replies are listed 'Best First'.
Re: Re: What is it about perl that makes perl so cool?
by merlyn (Sage) on Dec 03, 2000 at 13:42 UTC
    Java is a true OO language
    Java is no more a true "OO" language than C++ or Perl. It's a hybrid language, requiring one set of methodologies when you are working with objects, and another set when you are working with "primitives".

    For a true OO language, look at Smalltalk, Eiffel, Scheme, or (dare I say) Ruby.

    -- Randal L. Schwartz, Perl hacker

      Sorry to recreate a dead thread but.. Conversations like this really get me in a huff. I dont like to see languages being catagorised as OO or otherwise, when such a catagorisation is only being made to place one language above another. (I know merlyn was not dong this but my dander is up so I am gonna rant a bit)

      What exactly is an OO language?? What, for that matter, is OO? You cant have a 'true' OO language because OO is a programmers or designers construction. A programming language can at best support OO constructs, however such support is NOT required for OO programming.

      I have written 'true' OO C, now it is clear that C has no OO support within it. I have however implemented polymorphism (of sorts) inheritence (of sorts). I have also (hangs head in shame) written java with a single object and a whole pile of static methods, I was in a a hurry OK! ;-) ).

      A language is a not OO a program is. Perl has the capabilities to support OO programming ideas, it itself is neither OO nor not OO. I consider myself a good programmer, I like the OO principles. When writting perl I use OO designs.. exactly the same as when I write java.

      WORD!


      --

      Zigster

        I learned my OO from C++, then I thought that I mastered it with Java. But when Perl reared it's head at me, I learned that I had a lot to learn about OO.

        So far, Perl is really teaching me more about OO than Java or C++ did.

        Just my 2 cents . . .

        Jeff

        L-LL-L--L-LL-L--L-LL-L--
        -R--R-RR-R--R-RR-R--R-RR
        F--F--F--F--F--F--F--F--
        (the triplet paradiddle)
        
        When we say a language "is OO", we use that as shorthand for "there is a way of easily accessing polymorphism, abstraction, and inheritance". You are splitting hairs along a non-normal crease to redefine that statement.

        Sure, you can do non-OO stuff with an "OO language".

        Sure, you can do OO stuff with a "non OO language".

        But your definition doesn't help distinguish the languages which make you fight against the grain for OO. So it's a pretty useless definition for most of us.

        Fine to do this in the privacy of your own cube, but posting a headline like "Perl is not OO" will get you nailed pretty bad in this community, and does no justice to those who walk away saying "Oh, I heard Perl is not OO, but Java definitely is...". Now you've done us all an injustice.

        -- Randal L. Schwartz, Perl hacker

        "I have written 'true' OO C, now it is clear that C has no OO support within it. I have however implemented polymorphism (of sorts) inheritence (of sorts)."

        "(of sorts)" says it all. A language supports OO programming precisely to the extent that each programmer doesn't have to hack his/her own half assed version of an OO feature, be it polymorphism, encapsulation, multi-methods, etc.

        After all, any Turing complete language can be made to do _anything_ that can be done with computers. Some languages just make it a whole lot easier to program in a certain way. If you wan't to program in a truly OO way, then languages built with OO in mind from the start make your life a whole lot easier than those that had OO bolted on later.

        This is not to say that OO is the one true way. But if you _do_ want to program in an OO manner, your time is much better spent using Smalltalk, or Dylan, (to name a couple of languages with OO support from the ground up) than, say, C++ (to name a popular OO retrofit).
        I think that what merlyn is trying to say is that Java, Perl, C++ are hybrid-OO languages because they support non-object types like int, float or scalar. Smalltalk is a true-OO language because everything is an object.

        I don't think that he means the true/hybrid-OO adjectives have any implication as to the worth of the language... they're purely descriptive.

        And, yes, you can write perfectly good OO code in C. That's how the original C++ was designed.

      Merlyn is (as usual) correct. I guess I should watch my exact words. What I should have said:

      Java is a language that from the beginning has implemented OO principles. Java's structure also lends itself more towards doing things in an OO-manner.

      Perl began as a procedural language. It has evolved to the point that it is possible to only write OO code in it, but at the same time, the procedural roots show. Not that this is a bad thing. I would hate to be required to invoke several methods on new objects in a script when i only wished to search and replace through a flat file.

      I didn't mean to start a fscking war in this thread; I just found it odd that every post under this thread worshipped perl as the "One True Language". And while perl is my preferred language, there are things that i'd like to see change (and i'm not the only one). Java has it's advantages, and it seemed to me that the original posting was asking what made perl so much cooler in comparison to java. I just wanted to point out that perl doesn't beat out java in every area, and to try to stimulate discussion . I mean, how interesting is it to read 20 threads that say "perl/cpan/cgi.pm/regexes are so cool/" ? We already knew that, or else we wouldn't be here......

      BlueLines

      Disclaimer: This post may contain inaccurate information, be habit forming, cause atomic warfare between peaceful countries, speed up male pattern baldness, interfere with your cable reception, exile you from certain third world countries, ruin your marriage, and generally spoil your day. No batteries included, no strings attached, your mileage may vary.
Buzzcutbuddha: (Java Exception Handling)Re: What is it about perl that makes perl so cool?
by buzzcutbuddha (Chaplain) on Dec 11, 2000 at 17:12 UTC
    >1) try / catch >I'm not the most experienced java programmer (a year or so
    >while i was at school), but i really disliked having to
    >check for errors from a method with two separate blocks of
    >code. I disliked even more the fact that you had to know
    >the specific exception that each method would throw.


    Actually I believe that the Java exception handling is quite elegant.
    As a developer, you should already have an idea of where your errors might occur
    (hence Perl's DIE, which you place after where you think a problem will occur),
    and what type they will be (you expect to get an int and the user inputs a double brings about a ParseException)
    and so writing Try/Catch statements makes sense. It localizes the error handling to the code that is most likely to bomb out.
    Just my $0.02

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://44624]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-19 20:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found