Sponsored Link •
Interface Design by Bill Venners
Use interface extension to decouple services or restrict the semantic contract
Interface Design |
interface extension to decouple services or restrict the semantic contract.
Can decouple services from one another, to encourage clients code be as
type-precise as possible
void add(int, Object),
ListIterator listIterator(), etc...
Can also build trees upwards:
Can't just slap interfaces together -- semantics must be compatible (though not necessarily identical)
Subinterface semantics can be more concrete (more restrictive) than superinterface semantics
Set doesn't declare any new methods compared to
Semantic contract of
Collection - Ensures that this collection contains the specified element.
Set - Adds the specified element to this set if it is not already present.