Chapter 5. Defining Contracts with Duck Typing
This chapter will illustrate an enhanced technique that allows us to define contracts between objects interacting each other. This technique, named duck typing, allows for implementing something similar to interfaces supported by many classical Object-Oriented Programming languages. The topics covered by the chapter are:
- Checking dynamic data types
- Contracts between software components
- Using duck typing
- Emulating interfaces with duck typing