jargon

Design patterns·Objects, messages and the principles

the type on the field is the interface, and the only line that names the concrete class is the one that builds it.

Programming to an interface

Also calledcode to an interface, depend on abstractions, program to an interface, not an implementation

Declaring parameters, fields and return types in terms of what a collaborator can do rather than which class it is. It is the single sentence most of the catalogue is a consequence of: you cannot substitute, decorate, proxy or fake something your caller has hard-typed to a concrete class. In practice it earns its keep the first time you need a second implementation, and costs you an extra file every time you never do.

Commonly confused with