December 2016
Intermediate to advanced
841 pages
17h
English
As we have previously mentioned, interfaces are fundamental features when it comes to following the SOLID principles, and we have already put the first two SOLID principles into practice.
We have already discussed the single responsibility principle. Now, we will see real examples of the three remaining principles.
The Liskov substitution principle (LSP) states, Subtypes must be substitutable for their base types. Let's take a look at an example to understand what this means.
We will declare a class named PersistanceService, the responsibility of which is to persist some object into some sort of storage. We will start by declaring the following interface:
interface PersistanceServiceInterface ...
Read now
Unlock full access