Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^4: A Perl vs. Java fight brews

by ikegami (Patriarch)
on Jul 24, 2006 at 18:01 UTC ( [id://563337]=note: print w/replies, xml ) Need Help??


in reply to Re^3: A Perl vs. Java fight brews
in thread A Perl vs. Java fight brews

But, not matter what, you must put all of that in a class. Hence the charge: Java is Object Oriented Only.

Same in Perl. If one is not specified explicitely, main is used.

You can't just write a driver

You can't have driver code in C either, but that doesn't stop you from coding procedurally in C. That Java can't have drive code does not preclude programmers from writting procedural Java programs.

Perhaps these differences seem small, but they are real.

I didn't say there weren't differences. (Quite the opposite.) I said programmers code procedurally in Java, so it's not only OO.

Replies are listed 'Best First'.
Re^5: A Perl vs. Java fight brews
by Fletch (Bishop) on Jul 24, 2006 at 18:11 UTC

    I think you're both talking past each other here. What I believe he's trying to emphasize may be that while with perl you've got this:

    #!/usr/bin/perl print "Hello, world\n";

    In Java you're going to have to break out:

    public class HelloWorld { public static void main( String args[] ) { System.out.println( "Hello, world\n" ); } }

    Perl makes it dead simple to whip out call-this-call-this-call-this-boom-done style code, whereas to get the same thing in Java you've got to write a whole lot more overhead explicitly (i.e. you'd have a whole lot of static methods in some class rather than just a couple of subs hiding at the bottom of your quick, declarative Perl).

    Update: Upon reflection, that's probably not what they mean by OO only. Maybe someone's thinking "pure OO", but then Java's not (c.f. int and other primitive, non-object types). Never mind me.

    But maybe my last paragraph will be of some use to the OP.

    Or not. Meh.

      If we are talking past each other, he's trying to say "Perl is more readable" or "Perl requires less structure", why is his conclusion "Hence the charge: Java is Object Oriented Only."? I was challenging the four claims that Java is only OO, and his conclusion indicates he was still on subject.

      If he's no longer on that subject, he's trying to show that Perl is more readable and/or that Perl requires less structure. I'm not interested in that because I agree with those propositions. I'm interested in knowing why people claim Java is only OO.

      Java has probably been marketed as an exclusively OO language. It was surely designed to be. But that doesn't mean one can't do procedural programming in Java as easily as OO programming in Java.

      Update: Reordered for clarity.

        I realize you're technically correct that you can do procedural programming with Java, but what I meant by that comment is basically what philcrow said. Although Java has some native types that are not objects, you have to instantiate objects to do anything useful. So to me that means that Java doesn't support non-OO programming.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-03-29 12:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found