Moo

I ran across a thread on iwethey.org, where Jim Weirich wondered about
message-object-oriented (not sure if that’s a double-hyphenated word or
not) and function-object-oriented languages.


Message Object Oriented vs Function Object Oriented

In the “Great OO Argument Closer” thread, Todd Blanchard shared these
thoughts from Alan Kay …

[Kay] thinks people have largely missed the point. Its not so much that
there are classes and objects, but that there is a messaging system and
every object may be thought of as a server. This is markedly different
from the function calling behavior of the so-called “normal” […]
languages.
Given that there are Message Object Oriented (MOO) and Function Object
Oriented (FOO) languages, I have two questions that I think would be
interesting to explore:

(1) What is the essential feature or features that differentiate a MOO
language from FOO language? (Is it Duck Typing? Dynamic VS static
typing? Keyword messages?)

(2) Kay obviously prefers a MOO language. What are the inherit
advantages of MOO over FOO? How about advantages of FOO over MOO?

This struck a chord with me because I’ve wondered about the syntax for
sending messages to objects. The OO languages I’m familiar with all seem
to put the focus on the receiver rather than the message, in such a way
is to imply that the two are necessarily coupled:

reciever.message( arg1, arg2 )

Maybe because I read left to right, or because I first learned
procedural programming languages, but this format strongly suggests that
the message is part of the object. It doesn’t help, of course, that
pretty much all the popular literature conflates message with method,
largely I suppose because that’s pretty much how it is in Java.

I wondered if a syntax that emphasized the message would help me think
about OO programming differently. I wanted something like

message obj
or
message obj ( arg1, arg2 )
or
message( arg1, arg2 ) -> obj

I set about finding a way to do it in Ruby, and came up with an addition
to the Symbol class. I wasn’t sure if I wanted to have a full-blown
Message class; I liked the idea that one could just type the message to
send without having to go create a special object for it. The Symbol
syntax makes this very natural

class Symbol
def >>( *args )
ary = []
arglist = (block_given? ? yield : nil )
args.each{ |obj|
begin
ary << dispatch( obj, arglist )
rescue Exception
ary << $!.clone
end
}
ary
end

def dispatch( obj, arglist )
return obj.send(self.to_s, *arglist) if arglist && (arglist.size>0)
obj.send( self.to_s )
end
end

This allows expressions like:

:some_message.>> obj
:some_message.>>( obj1, obj2 )
:some_message.>>( obj1, obj2 ){ [ arg1, arg2, arg3] }

Any message string, instantiated as a Symbol, can be dispatched to a
list of objects, along with a set of message arguments. The results
come back as an array.

It shouldn’t be too hard to add some way to pass object criteria instead
of a list of specific objects, such that you could send a message to all
objects in ObjectSpace that are derived from a particular class, or
respond to some particular method, or have the string “Foo” in their
class name. In way, then, you could “broadcast” a message and collect
the results from all recievers meeting some criteria.

This is all good fun, but so far it hasn’t switched on too many
pragmatic light bulbs for me. Part of me thinks this is because I just
haven’t spent much time working with; I’m too adapted to more common
programming conventions. But another part of me thinks this may just be
another “Look what you can do in Ruby” trick.

Any thoughts on this sort of syntax, or this specific Ruby hack, or
MOO/FOO in general?

What other syntax would one need for a true message-oriented programming
lanaguge?

(BTW, there’s a very good history of Smalltalk article by Alan Kay
available at
http://www.metaobject.com/papers/Smallhistory.pdf. It’s a reprint from
an ACM publication. There’s also a good Kay quote about messaging at
http://www.omnigroup.com/mailman/archive/macosx-dev/2000-July/002850.html)

James Britt

Sounds like a bunch of moo foo goo to me.

Jim

···

On Thursday, 31 July 2003 at 5:06:27 +0900, james_b wrote:

I ran across a thread on iwethey.org, where Jim Weirich wondered about
message-object-oriented (not sure if that’s a double-hyphenated word or
not) and function-object-oriented languages.


Jim Freeze

[snip]

The OO languages I’m familiar with all seem to put the focus on the
receiver rather than the message, in such a way is to imply that the
two are necessarily coupled:

reciever.message( arg1, arg2 )
Maybe because I read left to right, or because I first learned
procedural programming languages, but this format strongly suggests
that the message is part of the object.

[snip]

I think there are a couple of things going on here.

First, the human interface idea is that people first select an object
and then decide what they want to do with that object. For example, one
might select a word processing file and then open it, print it, email
it, convert it, etc.

Second, there is the linguistic factor. I think it is not so much that
you read left to right but that English sentences are formed in
subject-verb-object order. The subject is, perhaps, the controller part
of the program, the verb is the method and the object is … the
object. The order in object oriented programming languages is (always?)
subject-object-verb. Interestingly, this is also the order in Korean
and Japanese (and a few other languages).

Regards,

Mark

···

On Wednesday, July 30, 2003, at 04:06 PM, james_b wrote:

Jim Freeze wrote:

I ran across a thread on iwethey.org, where Jim Weirich wondered about
message-object-oriented (not sure if that’s a double-hyphenated word or
not) and function-object-oriented languages.

Sounds like a bunch of moo foo goo to me.

Why?

James

···

On Thursday, 31 July 2003 at 5:06:27 +0900, james_b wrote:

Jim

Mark Wilson wrote:

[snip]

I think there are a couple of things going on here.

First, the human interface idea is that people first select an object
and then decide what they want to do with that object. For example, one
might select a word processing file and then open it, print it, email
it, convert it, etc.

True, perhaps, but there are many times people know they want to do
something, but don’t yet know how to accomplish it; they don’t know the
exact objects to involve. The emphasis is on the action, not the object.

Second, there is the linguistic factor. I think it is not so much that
you read left to right but that English sentences are formed in
subject-verb-object order. The subject is, perhaps, the controller part
of the program, the verb is the method and the object is … the object.
The order in object oriented programming languages is (always?)
subject-object-verb. Interestingly, this is also the order in Korean and
Japanese (and a few other languages).

Interesting then that we aren’t talking about KleinSpreche (pardon my
language mangling!), and why I’m curious abut the effects of shifting
the focus from object to message.

(Also interesting is that you say “the verb is the method” rather than
“the verb is the message.”)

Kay’s comments suggest that he was always more interested in the
messaging aspect than the object part, and that the term
“object-oriented” was something of an unfortunate buzzword. The OO part
being a good way to implement a messaging environment, not so much an
end in itself. The message is the medium.

James

···

Regards,

Mark

Not always. The OO extensions in Ada make a method call look like a
normal function call where the target of the message is the first
argument.

BTW: Apologies for the MOO/FOO acronyms. They were meant for a
convenient shortcut in that discussion. I hope they don’t propagate too
far beyond that.

···

On Wed, 2003-07-30 at 18:47, Mark Wilson wrote:

The order in object oriented programming languages is (always?)
subject-object-verb.


– Jim Weirich jweirich@one.net http://onestepback.org

“Beware of bugs in the above code; I have only proved it correct,
not tried it.” – Donald Knuth (in a memo to Peter van Emde Boas)

Mark Wilson wrote:

[snip]
I think there are a couple of things going on here.
First, the human interface idea is that people first select an object
and then decide what they want to do with that object. For example,
one might select a word processing file and then open it, print it,
email it, convert it, etc.

True, perhaps, but there are many times people know they want to do
something, but don’t yet know how to accomplish it; they don’t know
the exact objects to involve. The emphasis is on the action, not the
object.

I see your point. I do think it’s usually easier to learn objects first
and then actions (messages to invoke a method), because each object can
have a multitude of methods. However, to its great credit, Ruby also
makes it easier to think of a method and then find the object that
implements it (with the input and output desired).

Second, there is the linguistic factor. I think it is not so much
that you read left to right but that English sentences are formed in
subject-verb-object order. The subject is, perhaps, the controller
part of the program, the verb is the method and the object is … the
object. The order in object oriented programming languages is
(always?) subject-object-verb. Interestingly, this is also the order
in Korean and Japanese (and a few other languages).

Interesting then that we aren’t talking about KleinSpreche (pardon my
language mangling!), and why I’m curious abut the effects of shifting
the focus from object to message.

Forgive my ignorance, but I don’t understand the meaning of your
reference to that other pure object-oriented language :slight_smile:

(Also interesting is that you say “the verb is the method” rather than
“the verb is the message.”)

I agree. I do group message and method together. I think this arises
from me not yet being comfortable with objects communicating with each
other – my programs usually involve a single controller that handles
all messaging (method calls).

Kay’s comments suggest that he was always more interested in the
messaging aspect than the object part, and that the term
“object-oriented” was something of an unfortunate buzzword. The OO
part being a good way to implement a messaging environment, not so
much an end in itself. The message is the medium.

I’ll think about this.

Regards,

Mark

···

On Wednesday, July 30, 2003, at 07:27 PM, james_b wrote:

It was a joke. MOO FOO GOO.

Message OO, Function OO, Good (I forget) OO.

···

On Thursday, 31 July 2003 at 7:38:42 +0900, james_b wrote:

message-object-oriented (not sure if that’s a double-hyphenated word or
not) and function-object-oriented languages.

Sounds like a bunch of moo foo goo to me.

Why?


Jim Freeze

Life would be so much easier if we could just look at the source code.