From Design Patterns by Gamma et al:
This so greatly reduces implementation dependencies between subsystems that it leads to the following principle of reusable object-oriented design:
Program to an interface, not an implementation.
Don't declare variables to be instances of particular concrete classes. Instead, commit only to an interface defined by an abstract class. You will find this to be a common theme of the design patterns in this book.
What does "Don't declare variables to be instances of particular concrete classes. Instead, commit only to an interface defined by an abstract class" mean? Can you give some examples?
Thanks.
Aucun commentaire:
Enregistrer un commentaire