For OCA
Java SE 7, Mala Gupta does not mention "Programming to an Interface" in her book.
Edward Finegan mentions the following points on page 312 of his book.
Programming to an interface is the concept that
1. Code should interact based on a defined set of functionality instead of an explicitly defined object type.
2. It is better for the public interfaces of objects to use data types that are defined as interfaces as opposed to a particular class when possible.
3. When an object is implementing an interface, it is declaring that it has a certain set of functionalities.
4. Many different classes can implement the same interface and provide its functionality.
5. When a method uses an interface as its argument type, it allows any object, regardless of its type, to be used as long as it implements the interface.
6. Programming to an interface is also known as "design by contract."
7. Programming to an interface allows the developer to specify the capabilities or behaviors that are expected, instead of strictly defining an expected object type.
Example of Programming to an interface:
Question: Besides the points listed for "Programming to an Interface",
what additional items should one be aware of with respect to this topic?
Any additional examples of "Programming to an Interface" would be appreciated?