Protocol Composition
Protocol inheritance is a powerful tool that lets you easily create a new protocol that adds requirements to an existing protocol or set of protocols. Nevertheless, using protocol inheritance can potentially lead you to make poor decisions in creating your types.
In fact, that is exactly what has happened with TabularDataSource. You made TabularDataSource inherit from CustomStringConvertible because you wanted to be able to print a description of the data source. (In fairness, you did it because we told you to.) But there is not anything inherently CustomStringConvertible about a tabular data source. Go back and fix that misguided attempt to print data sources.
Listing 19.14 TabularDataSource should not be ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access