On Saturday, September 27, 2003, at 07:46 AM, Dan Sugalski wrote:

The problem with checking for a single method by name is that it's possible (potentially likely) that the method you find isn't the method you want, since names short enough to be useful are short enough to be confusing. ("rotate" is a perfectly good name for a method that does matrix manipulation, image manipulation, and UI element manipulation -- just because an object says it can rotate doesn't mean that it actually does what you want)

It's certainly possible to have multiple interfaces with the same name that do different things, but that's less likely, and it still gives the programmer another way to make sure code'll behave the way he/she/it wants.

Another place where interfaces are useful is in a distributed computing context, because you can inquire about the capabilities of a remote object in one round trip by asking if it implements a particular interface, rather than asking about each method individually.


JEff

Reply via email to