News for hackers. Stuff that matters.
Re:Is Clean Code Necessary? by ethagnawl on Tuesday August 09, 2016 @06:17AM (#12253595)
You're correct.

From Wikipedia[0]:

> Liskov's notion of a behavioral subtype defines a notion of substitutability for mutable objects; that is, if S is a subtype of T, then objects of type T in a program may be replaced with objects of type S without altering any of the desirable properties of that program (e.g. correctness).

0: https://en.wikipedia.org/wiki/Liskov_substitution_principle

Re:Is Clean Code Necessary? by Ntrails on Tuesday August 09, 2016 @06:38AM (#12253659)
Surely it follows logically anyway?

Assuming sub/super are referring to inheritance (sorry, I'm a bad), a sub contains all of a super and more. Passing through an object with more shouldn't break anything. But a super might lack things the sub has, thereby breaking assumptions about what will be present.

I feel like the principle would be broken by the objects/inheritance being badly used rather than the calling code though?

Re:Is Clean Code Necessary? by talideon on Tuesday August 09, 2016 @07:36AM (#12253842)
LSP doesn't specifically deal with inheritance; it's equally applicable to interface implementation.