Chapter 2
Design for Test
Section 2
Why Interfaces?
Many hobbyist programmers don’t understand why we should use interfaces. The first part of understanding interfaces is understanding polymorphism: the variable type tells us what methods we’re allowed to call, and the object type tells us what will happen when we call those methods. Interfaces decouple the variable from the object type and allow us to easily change the object type. - Create a new package to hold a DTO class. - Create a simple interface with one method. Show how the DTO can be used in the method signature. - Create and describe JavaDoc on an interface.