programming to an interface

I've just heard of a practice called 'programming to an interface'. I'm not sure what it is, maybe writing code with the methods of an interface in mind. Can anyone explain?
[184 byte] By [allelopatha] at [2007-11-27 4:41:15]
# 1

Have you ever written any JDBC code? You "coded to an interface" then. The java.sql package defines interfaces (Connection, Statement etc) that you write your code against, and at runtime you load a specific JDBC driver which provides an actual implementation for those interfaces. But notice that you don't need to know you're using a particular driver when you're actually writing the code. That is "programming to an interface" in a nutshell: it allows you to not worry about the implementation details until later

georgemca at 2007-7-12 9:52:34 > top of Java-index,Java Essentials,Java Programming...
# 2
> I've just heard of a practice called 'programming to> an interface'. I'm not sure what it is, maybe writing> code with the methods of an interface in mind. Can> anyone explain?I can't exactly but google
CodeOnFire-againa at 2007-7-12 9:52:34 > top of Java-index,Java Essentials,Java Programming...
# 3
>>Have you ever written any JDBC code?Yes, I have. Thank you for this very clear and concise explanation.It seems to happen often that I hear some terminology and I don't know what it means, but then it turns out I've done it.
allelopatha at 2007-7-12 9:52:34 > top of Java-index,Java Essentials,Java Programming...
# 4

>>>Have you ever written any JDBC code?

>Yes, I have. Thank you for this very clear and concise explanation.

And sometimes you can tell when people are uncomfortable with this.

They ask questions like: where are the implementations of Connection, Statement,

etc... What are the concrete classes? You have to tell them to stop worrying

and learn to love the abstraction...

Hippolytea at 2007-7-12 9:52:34 > top of Java-index,Java Essentials,Java Programming...