From Liskov Substitution Principle - www.blackwasp.co.uk
One common indication of non-compliance with the LSP is when a client class checks the type of its dependencies. This may be by reading a property of an object that artificially describes its type or by using reflection to obtain the type. Often a switch statement will be used to perform a different action according to the type of the dependency. This additional complexity also violates the Open / Closed Principle (OCP), as the client class will need to be modified as further subclasses are introduced.
Does following techonolgies (that use reflection) cause a violation of LSP?
- Dependency Injection
- Inversion Of Control
Note: I am from C# background.
From http://blogs.msdn.com/b/simonince/archive/2008/06/30/dependency-injection-is-dead.aspx
Reflection; most (perhaps all?) Dependency Injection containers rely on some extent on Reflection – dynamically inspecting objects and determining their dependencies.
REFERENCES:
How can I avoid breaking Liskov Substitution Principle (LSP)?
Does Liskov Substitution Principle also apply to classes implementing an interface?
Does this violate the Liskov substitution principle, and if so, what do I do about it?
Does GWT's ActivityMapper violate the Liskov Substitution Principle?