From: Robert Klemme Date: 2008-05-25T20:29:47+09:00 Subject: Re: OOP in Ruby? On 23.05.2008 00:15, James Britt wrote: > Robert Klemme wrote: >> 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. I believe there is usage for both approaches - even within the same project: usually I create classes from the outside, i.e. I decide about their responsibilities, their interface and then I decide how they should be implemented. In other cases, e.g. when implementing a particular algorithm I probably will first think about the internals and then decide which input or interface a class needs. In both cases though clarifying responsibilities of a class (-> CRC cards) is the first and most important step IMHO. > 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. I am not sure I get your point here. Looking at e.g. interfaces in java.util what else is this than a separation of behavior (e.g. map lookup) from the implementation (HashMap, TreeMap)? > In some ways it is similar to the difference in behavior-driven > development and test-driven development. > > Point of view matters. At least as a means for reasoning about how one does software development and which alternative approaches are around. Thank you for your input! Kind regards robert