OT - Re: GPL Java
rosswerner at gmail.com
Sat Nov 11 13:05:23 MST 2006
On Sat, 11 Nov 2006 09:49:25 -0800, Hans Fugal <hans at fugal.net> wrote:
> On Fri, 10 Nov 2006 at 08:16 -0800, Ross Werner wrote:
>> I'm still not convinced. I'd love to see some production Smalltalk or
>> code that is object-oriented that is less noun-oriented than its Java
>> counterpart would be. The examples in the article are, of course,
>> exaggerations, and neither production Java or Smalltalk or Ruby code
>> really look like that. But they would definitely be more "noun-oriented"
>> than equivalent procedural code.
> Then go look for some. I'm not convinced you care enough about your POV
> for us to care that you're not convinced. You obviously don't *get*
> smalltalk or ruby. For one thing, you can write "procedural code" in ruby
> and write like you're in C or perl. It's ugly and not the ruby way, but
> it shoots a hole in your argument,
I'm not sure we're talking on the same page here. Certainly you can write
procedural code in ruby just like you can write procedural code in Java.
I've seen Java code that looks nearly identical to C many a time. To me,
it's always quite obvious when I look at code written by a C programmer
who's new to Java and doesn't quite "get" objects or the reason for them.
So I'm not sure why the fact that you can write procedural code in ruby or
Java shoots a hole in my argument. I guess I wasn't clear enough on what I
was trying to say, so let me restate:
Java code tends to be very noun-oriented. In other words, you typically
call component.paint() rather than paint(component), and you typically see
functions like suggestor.suggest(foo) rather than just suggest(foo). My
contention is that this noun-orientation is common to all object-oriented
code, and is not specific to Java. The fact that Java does not allow
top-level functions like ruby or perl is a red herring--any top-level
function could be transformed into a static method on the Main class in
Hopefully that clarifies my position. I followed your advice and went to
freshmeat and looked for the first ruby project I could find:
It seems to be very procedural in nature, with many top-level functions
(that would be the equivalent of static methods on the Main class in
Java). In addition, there seem to be a lot more static methods in the core
libraries (such as File.open or Dir.rmdir or FileTest.exists) than in
Java. These sorts of things are more verb-oriented and less noun-oriented,
but I also contend they are less object-oriented and more procedural.
Not that this is a bad thing! Note that I'm not saying that
object-oriented code is better than procedural code or vice-versa. My only
argument is that the complaint that Java is too noun-oriented is simply
complaining that Java is too object-oriented, and that similarly
object-oriented code will be just as noun-oriented, and if you write
procedural Java code, your code will be more verb-oriented. I think it's
just a matter of taste as to which you prefer, and neither is necessarily
superior to the other.
More information about the PLUG