Just like with the object-oriented design, we will start off with a type diagram that shows the types needed and the relationships between them. The following diagram shows our protocol-oriented design:
As we can see, our POP design is quite a bit different from our OOP design. In this design we use three techniques that make POP significantly different from OOP. These techniques are protocol inheritance, protocol composition, and protocol extensions. It is important to understand these concepts so, before we go into our design, let's look at what protocol inheritance and protocol composition are. We looked at protocol extensions in the last chapter.
Protocol inheritance is where one protocol can inherit the requirements from one or more other protocols. This is similar to class inheritance in OOP but instead of inheriting functionality we are inheriting requirements. We can also inherit requirements from multiple protocols whereas a class, in...