dimanche 30 novembre 2014

Do the implementations of the Node interface in Web API violate Liskov Substitution Principle?


MDN article on Node interface states that



interfaces [that inherit from Node interface] may return null in particular cases where the methods and properties are not relevant. They may throw an exception - for example when adding children to a node type for which no children can exist.



To me it seems like a strengthening of preconditions in a subtype - a violation of LSP.


Do these implementations actually violate LSP, or is my understanding incorrect?





Aucun commentaire:

Enregistrer un commentaire