From: Daniel Waite Date: 2006-08-22T09:12:48+09:00 Subject: Re: Strategy pattern / interface design arrangement Phrogz wrote: > The short of it is: two different classes of objects are > interchangeable if they both support the same (named) methods that code > using those objects invoke. You don't need static-typing or > compile-type checking. You don't need interfaces. You don't need > contracts. You just need to have the methods available that you are > going to call. Thank you! That's what I needed to hear! :) :) :) I figured as much. From my experience with PHP 4, with weak OO support, you could still code in a manner similar to C++ or Java without all the rules _enforcing_ a particular paradigm. I think what you said can be summed up in: Code to an interface, not an implementation. Granted, that mentions one of the things you said you don't need, but here's my codified understanding of it: Implementation: @authorize_net = AuthorizeNet.new @authorize_net.process_card(card) Interface: @payment_processor = AuthorizeNet.new @payment_processor.process_card(card) That may be a weak example, but I think it illustrates the point. When the "physical" variable I'm using tells me more about the object that it should. E.g. "this is an AuthorizeNet object," versus "this is some kind of credit card processor." Thanks all! -- Posted via http://www.ruby-forum.com/.