From: Sean O'Dell Date: 2003-11-20T06:05:21+09:00 Subject: Re: "stereotyping" (was: Re: Strong Typing (Re: Managing metadata about attribute types) ) On Wednesday 19 November 2003 12:37 pm, Weirich, James wrote: > From: Austin Ziegler [mailto:austin@halostatue.ca] > > > Anecdotally, I did some work with Ruwiki recently and Chad Fowler > > created a mock object to make the Ruwiki tokenizing process think > > that it was dealing with an instance of Ruwiki. That mock object has > > become part of Ruwiki's object hierarchy, although not as Chad > > defined it. (I abstracted the data that Chad was using into its own > > object.) If I had done ancestry checking initially, Chad wouldn't > > have been able to do this. > > I think this is a strong example of what we are talking about. Checking > for a concrete Ruwiki object would have prevented this kind of > generalization. Some might say that you shouldn't check against a concrete > object anyways, but should be using an abstract object. The point is that > at the point Chad was experimenting with Ruwiki, there was no abstract > object. The Ruwiki programmer had no need to create an abstraction, and > indeed would have been hard pressed to create one (usable by Chad) without > understanding Chad's needs (which weren't defined at the point Ruwiki was > written). Explicit ancestry checking makes this kind of development more > difficult. > > And I wish to emphasize that this is not an isolated incident. This > happens all the time in the test frameworks I tend to develop with my Ruby > programs. I agree, but "interface checking" doesn't have to involve developing an abstract, nor does it require inheritance. You can say: class MyFakeRuwikiClass interface RuwikiClass end The above is a class which does not inherit from RuwikiClass, but declares itself an implementation of the RuwikiClass interface. Further, the original developer of RuwikiClass did not have to develop an abstract. The interface declaration is just a statement; no methods are checked, nothing is inherited. It's just a way to keep the developers head up about what they're doing. Sean O'Dell