Applying S.O.L.I.D. Principles in .NET C#
54 0 4287
If you never heard of the S.O.L.I.D. principles you should see this video to develop better C# code. A 'must' for every professional developer.
By splittingTimes 2019-08-12
Well it would have been nice if he stated his interpretation of the Liskov Substitution Principle. The way i understood it best was here .
A subclass should behave in a way that it never cause problems when it is used instead of the base class.
In concrete terms:
* No new exceptions are allowed to be thrown, unless they are subtypes of the exception thrown by the base class
* Preconditions cannot be strengthend by the subtype
* Postconditions cannot be weakened by the subtype
For me it is really the focus of using inheritance only if you want substitutability. Otherwise go with composition.
Popular Videos 145694