Interfaces and Contracts
Apress eBooks · 2007
D uring 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. These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.