"typing" object variables

During my reading, I've come across the phrase "code to the interface" quite often.Would this be a fair statement?"That's Java-speak for the idea of declaring variables to the type with the most generally useful methods for your object."Thanx to one and all.
[295 byte] By [LazarusLonga] at [2007-11-27 8:35:12]
# 1
> "That's Java-speak for the idea of declaring variables to the type with the most generally useful methods for your object."Variables... and method return types and parameter types, too.
Hippolytea at 2007-7-12 20:31:38 > top of Java-index,Java Essentials,New To Java...
# 2
Was that a "yes"?
LazarusLonga at 2007-7-12 20:31:38 > top of Java-index,Java Essentials,New To Java...
# 3
> Was that a "yes"?I'd call it a yes with a little expansion/clarification.
jverda at 2007-7-12 20:31:38 > top of Java-index,Java Essentials,New To Java...
# 4
Thank you both.
LazarusLonga at 2007-7-12 20:31:38 > top of Java-index,Java Essentials,New To Java...
# 5

First, coding to the interface is a user centric view not a implementation one. Thus "return types" have nothing to do with that since return types are always implementation.

And I suspect parameters fall into that as well.

Secondly the interpretations above suggest a overly broad one of "code to the interface". The following link provides a more specific (small scope) definition which certainly allows one to discuss it in more concreate terms (and it certainly doesn't allow for return types.)

http://www.javaworld.com/javaworld/jw-08-1999/jw-08-interfaces.html

Finally it certainly isn't the most important aspect of the concept to use general scope variables to apply to an instance. So it would be wrong to equate the two terms. Although using that particular idiom is probably useful in maintaining the concept, it certainly isn't as important as how one creates objects and even designs. And the importance at that point is that the behavior is correct (and not how it is implemented.)

jschella at 2007-7-12 20:31:38 > top of Java-index,Java Essentials,New To Java...