On Nov 10, 2006, at 9:16 AM, Ross Werner wrote:
I'm still not convinced. I'd love to see some production Smalltalk
or Ruby 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 would really look like that. But they would
definitely be more "noun-oriented" than equivalent procedural code.
The key difference between the C++/Java model of OOP and the
Smalltalk/Ruby model of OOP is that in the former, the verbs are
entirely owned by the nouns, and in the latter they are merely
strongly associated. Clearly, a verb must have a different
implementation for a different type of data; in Java/C++, the verb
itself is bound to the type to ensure that there is always an
implementation available. In Smalltalk/Ruby, the verb exists
independent of the noun; you can validly send any message to any
object, though the object may not necessarily understand it. Nouns
can even provide ways to cleanly handle messages that they don't
understand. Perhaps you may still view it as noun-dominated, but it
is definitely on the borderline.
In the Common Lisp Object System, verbs don't belong to nouns at
all. They belong to 'generic functions' that can be given special
implementations to cope with different kinds of nouns. There are
more differences than that, but I believe this is the key difference
with regard to this discussion.
And you didn't even mention functional languages.
Okay, object-oriented programming is noun-dominated, procedural
programming is verb-dominated, and functional programming is
parentheses-dominated. Happy now? ;)
Most functional languages aren't particularly parenthesized these
days. SML, OCaml, Haskell, Scala, etc. Common Lisp doesn't even
make you write programs in a very functional manner, it just lets you
do so if you want to. It's definitely verb-oriented, though!
--Levi
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/