During your years as a software developer, you’ve likely come across the notion of interface-based programming. If you’re familiar with the seminal book, Design Patterns: Elements of Reusable Object-Oriented Software, by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides (known as the “Gang of Four”), 1 then you know that many design patterns employ interface-style “contracts.” If you’re not familiar with that book and its concepts, I urge you to read it. In this chapter, it is my goal to show you how you can model well-defined, versioned contracts using interfaces. In this context, a contract is an agreement by a type to support a set of functionality.
KeywordsInterface Type Concrete Type Interface Method Public Contract Public Class
Unable to display preview. Download preview PDF.
- 1.Design Patterns: Elements of Reusable Object-Oriented Software, by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides (Boston, MA: Addison-Wesley Professional, 1995), is cited in the references at the end of this book.Google Scholar