OT - Re: GPL Java

Hans Fugal hans at fugal.net
Sat Nov 11 22:26:04 MST 2006


On Sat, 11 Nov 2006 at 12:05 -0800, Ross Werner wrote:
> 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.  

By a similar token we can easily see when a new Java pilgrim starts out
in Ruby because of the Java-like approach to OOP.

> 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  
> Java.

Now, you can't have your cake and eat it too. Either Java is
noun-centric and requiring you to make static methods of the Main class
is silly (it is), or noun-centrism is a red herring. 

OOP is not about object.method(), OOP is about associating behaviors
with objects, which do data encapsulation and hiding. I completely agree
that OOP programmers often put the cart before the horse and place
behaviors in classes where it makes no sense. Sometimes it's just more
convenient that way in spite of its unnaturalness. Sometimes I think
it's wrong. I personally don't feel the least bit of obligation to put
behavior in a class that obviously belongs on its own (or in some other
class), but I do remember the early days when I followed the Java
tendency. Java to some extent forces it upon you, although not entirely.
Most OOP languages don't even go that far. OOP is not noun-centric. It's
object-centric (or shall we say object-oriented?). There is a
difference. Anyone who doesn't see it is probably blinded by the Java
paradigm, and might find some enlightenment by meditating on that point
for awhile. I think we're in agreement here.

> Hopefully that clarifies my position. I followed your advice and went to  
> freshmeat and looked for the first ruby project I could find:
> http://freshmeat.net/projects/cvsspam/

Never heard of it. In my experience Freshmeat is about as useful as a
day-old hamburger.

> 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.

If you want to see production ruby code, Ruby on Rails would be a good
candidate. Disclaimer: I haven't actually looked at the RoR code, but i
have it on good authority that it's written in the ruby style. It's
certainly production.

> 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.

So the only way we disagree is that you say Java is noun-oriented
because it's object-oriented, and I say you think object-oriented means
noun-oriented because of Java.

-- 
Hans Fugal ; http://hans.fugal.net
 
There's nothing remarkable about it. All one has to do is hit the 
right keys at the right time and the instrument plays itself.
    -- Johann Sebastian Bach
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://plug.org/pipermail/plug/attachments/20061111/ee751c22/attachment.bin 


More information about the PLUG mailing list