From: James Britt Date: 2008-05-23T07:15:45+09:00 Subject: Re: OOP in Ruby? Robert Klemme wrote: > On 22.05.2008 22:36, Rick DeNatale wrote: >> This was one of the early books approaching OO design in the context >> of Smalltalk, which introduced the computation by messages between >> objects. It advocates a role-based approach rather than the >> abstract-data type approach, corresponding to the C++ (and to a large >> extent Java) view of OO. > > Without wanting to start an indepth discussion about OO, but aren't > these just two sides of the same medal? The message metaphor seems to > lean a bit more on the client side while the ADT view is a bit more > about how messages transform internal state (although ADT is mainly > about observable state through sequences of method invocations). In the > end, in both cases an instance holds state which is changed via method > invocation / method sending and the implementation determines how the > state may be manipulated. Here's the key difference to me: Taking a message-orient POV, you do not assume that messages == methods. You think in terms of how an object does things internally, and then how it will handle messages. In Java the assumption is that any message you send has to map to a particular method. It does not encourage the same degree of encapsulation and emphasis on behavior being distinct from implementation. In some ways it is similar to the difference in behavior-driven development and test-driven development. Point of view matters. -- James Britt http://www.rubyaz.org - Hacking in the Desert http://www.jamesbritt.com - Playing with Better Toys