in reply to Why perl is more OO than C++ or Java...

While I could go into what makes an object oriented language object oriented, the most important distinction is that is the creation of data "objects." In this case, Perl is certainly not more object oriented than C++

Any HIGH LEVEL language hides the particular implementation of anything it does. Only writing in bytecodes or assembly hides nothing. I know that you don't consciously think of what register you are writing to when you make a variable in C.

What you are thinking of is how "high level" the language is. Which is to say, how abstracted from the hardware is it. Perhaps Perl is more high level, but again, I could argue that foundation classes and such make C/C++ just as high level as any visit to CPAN. Data hiding is only one aspect of an object oriented language. The reason PERL treats variables as it does is because of the nature of the interpretters that it is meant to replace.

Just Another Perl Backpacker
  • Comment on Re: Why perl is more OO than C++ or Java...

Replies are listed 'Best First'.
Re: Re: Why perl is more OO than C++ or Java...
by spm (Acolyte) on Sep 14, 2001 at 16:45 UTC
    I think what a lot of people are forgetting is that in essence, Perl is exactly as OO as for example Java, and possibly even more so. The reason I like Perl more than any other language is that Java for example, has a lot of stupidities that annoy the hell out of anyone who is trying to use it, for example having "string" as a primitive text string variable, and "String" as a Object designed to manipulate the "string" type, but is completely uncompatible with string unless you use the built in functions. With Perl, we manage to get over that sort of stupidity, whereas Objects are exactly the same as scalars - they look like scalars, but you can call subfunctions to them with things like $foo->bar(); This is pretty much the same because in Java Objects are just like other variables. Now, this does not prove my point. Lets see if this will: In Perl, we allways have a current package, as in Java, we allways have a current class - Perl is better and easyer to code however, because we don't have to write 4 lines of Perl just to be able to start writing Perl code, while Java people do - class foo { public void main() { } } being the bare minimum IIRC, while with Perl there is no minimum - just the #!/usr/bin/perl line, which is also optional to some extent. We allways have the main:: module, and that gives us a "class main" in a way. I'm not going to go on and on about this and that feature and/or bug in the implementation of Perl OO support, but I do think that Perl is in fact more OO than a lot of languages, without people even having to know that it is OO. And so what if people have to learn the language a bit better to be able to use those features? They're hackers, they're smart, they'll figure it out!
      ugh, am i feeding trolls here?

      Java for example, has a lot of stupidities that annoy the hell out of anyone who is trying to use it..

      look, you're obviously entitled to your opinion, but try not to generalize too much. java and perl are two different beasts, with varying syntax and corresponding idiosyncracies. just because YOU don't dig it, don't presume that "anyone who is trying to use it" finds the syntax to be annoying. sure, there are lots of things about java (and perl) that bug me; i doubt that my pissy "i want to gc NOW" reasoning would hold up to the sun engineers' countless hours of research, experience, and development.

      ..having "string" as a primitive text string
      uh, java doesn't have a primitive string type. there are benefits and costs associated with using String/StringBuffer objects; it's not "stupidity", it's a different programming paradigm.

      just because you can "start writing" code in a specific language with fewer keystrokes hardly makes it either "better" or "easyer"(sic). i hardly see how your brevity example has anything to do with OO either way. if you just want to bash java, start a new thread.

      Sorry, but had to respond to this:
      > Perl is better and easyer to code however, because we
      > don't have to write 4 lines of Perl just to be able to
      > start writing Perl code

      So this makes shell scripting a better language than Java,
      C, C++, Ada, assembly, etc.?

        This is also a reply to the other comment I got

        Okey. A lot of the things I said in the other comment weren't really thought through. Lets clear them up:

        Perl is the quickest and most enjoyable programming language that I've ever found, a lot due to the nice OO features and the fact that you don't have to write a lot of code to get things to work. C is however my second choice - it is clear and simple, yet powerfull as hell. Assembler is a good friend of mine, because where Perl saves code, Assembler saves memory. Well worth the bargain. But if I keep on the topic of Java, which is a language I cannot say I have ever had any good come from, I can count up a few things that I don't like about it in perticular - software engineering paradigms that are also solved in Perl, but in (IMHO) a much better way..

        "Compile once run anywhere (where a JVM is installed)" as opposed to just "run anywhere (where a Perl interpreter is installed)" - okey, this is a very debatable subject, but I think we can agree that Java almost allways runs to slow. Right? That's because of the Virtual Machine design, which is a pretty neat trick, but not the best thing for the users... and don't give me any bullshit here - we programmers are making programs that people use, shouldn't we be tailoring it to their needs rather than our own?

        The Class thing I talked about in my previous comment, except I think I was too vague... In Java, everything (with a few exceptions) is either a class or an object, which would be okey, except, you allways have to go through the (IMHO) tedious task of coding it as such. I worked as a developer for a Java firm for about a year, and was pretty happy to leave - all the frikkin' class definitions all over the place were driving me insane - not to mention the; syndrome all over the place througout the code. Sure, I can understand that some people like geneology a lot, but I for one don't.

        I have never coded anything in Ada, but as for C++, well, I like it a shitload better than Java, but a few things about it annoy the hell out of me. Most of them are pretty trivial, and I'll get over them. C++ is, IMHO, a pretty great language, one of the best, but in my mind it will allways be the hack that tried to fix the shortcomings of C by extending the syntax into a messy soup. Well, whatever floats you boat :)

        Now, I'm sorry if I started a flame fest, and wish to end it. EOFF (End Of Flame Fest)