From the course: Learning SOLID Programming Principles
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Interface variations - Python Tutorial
From the course: Learning SOLID Programming Principles
Interface variations
- [Tutor] I want to look at applying the Liskov substitution principle, in the cases where the subclasses do not match the superclass very well. Sometimes it's necessary to rethink the design to better align the subclass superclass relationship. And in other cases, it can help to apply the interface segregation principle, and refactor the definitions. A document in markdown format can contain tables of values. A table is very much like a CSV document, it has columns and rows. However, a markdown document may be a whole chapter of a book, which means there may be more than one table. This means the read method needs a parameter to select a specific table from a larger markdown document. But if we try to introduce an additional parameter to the read method, we can create a Liskov substitution problem. It looks like this. Here's an example of trying to introduce a new table index parameter to the read method. We get…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.