Principles
Programming to an Interface: Widen Concrete Parameter Types
Programming to an interface means a method asks for the interface it uses, not one concrete class that has it. A concrete parameter type turns every new class into a copied method. These lessons take a car rental desk that texts receipts, extract a MessageSender interface, widen the parameter, and then add email as one new class.
Pick your language
When to use it
Use it when
A method uses a small part of a class, and a second class could do that part.
Skip it when
Only one type will ever fill the parameter, like Rental. An interface for a data type adds a file and nothing else.
Spot it by
A concrete parameter type when the method calls one of its methods, and copied methods that differ only in that type.