Note that there are some explanatory texts on larger screens.

plurals
  1. PODoes Reflection violate LSP?
    primarykey
    data
    text
    <p>From <a href="http://www.blackwasp.co.uk/LSP.aspx" rel="nofollow noreferrer">Liskov Substitution Principle - www.blackwasp.co.uk</a></p> <blockquote> <p>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.</p> </blockquote> <p>Does following techonolgies (that use reflection) cause a violation of LSP?</p> <ol> <li>Dependency Injection</li> <li>Inversion Of Control</li> </ol> <p>Note: I am from C# background.</p> <p>From <a href="http://blogs.msdn.com/b/simonince/archive/2008/06/30/dependency-injection-is-dead.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/b/simonince/archive/2008/06/30/dependency-injection-is-dead.aspx</a></p> <blockquote> <p>Reflection; most (perhaps all?) Dependency Injection containers rely on some extent on Reflection – dynamically inspecting objects and determining their dependencies.</p> </blockquote> <p>REFERENCES:</p> <ol> <li><p><a href="https://stackoverflow.com/questions/6938071/hierarchy-violates-liskov-so-what">Hierarchy violates Liskov - so what?</a></p></li> <li><p><a href="https://stackoverflow.com/questions/10778354/how-can-i-avoid-breaking-liskov-substitution-principle-lsp">How can I avoid breaking Liskov Substitution Principle (LSP)?</a></p></li> <li><p><a href="https://stackoverflow.com/questions/12921465/does-liskov-substitution-principle-also-apply-to-classes-implementing-an-interfa">Does Liskov Substitution Principle also apply to classes implementing an interface?</a></p></li> <li><p><a href="https://stackoverflow.com/questions/3996819/does-this-violate-the-liskov-substitution-principle-and-if-so-what-do-i-do-abo">Does this violate the Liskov substitution principle, and if so, what do I do about it?</a></p></li> <li><p><a href="https://stackoverflow.com/questions/8368684/does-gwts-activitymapper-violate-the-liskov-substitution-principle">Does GWT&#39;s ActivityMapper violate the Liskov Substitution Principle?</a></p></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload