Re: LSP Was: Mixing OO and DB
Date: Fri, 22 Feb 2008 18:21:48 +0000
Message-ID: <fpn3s6$jal$1_at_aioe.org>
Robert Martin wrote:
> On 2008-02-22 03:37:45 -0600, S Perryman <q_at_q.com> said:
>> And for practical demonstration, I can take the apocrypthal >> Circle/Ellipse >> problem, and show that Circle is not a Liskov/Wing subtype of Ellipse >> without ever needing to see any program that may be using Circle or >> Ellipse >> types.
> To do so you must posit the property of mutability, or some other
> unsubstitutable property. It is quite possible to describe a Circle and
> an Ellipse that have substitutable properties.
Correct.
> By extension, if we must take into account every possible property, I
> think you could make the argument that no two types could ever have a
> subtype relationship since there will always be some possible property
> that is not substitutable.
You're on the road to understanding the fundamentals. Consider for any types T1/T2, that you can compute the percentage of properties P, for which substitutability is (or is not) ok.
The Liskov/Wing subtype demands P = 100 (which we can denote as PLW) .
In the real world, we will have types for which P < PLW.
The questions that I and others have debated are basically (for a typical s/w system) :
- should substitutability be all or nothing
- what *ROI* do we get when making all types where substitutability is being attempted, become Liskov/Wing subtypes.
- rather than just being lazy and not doing 1 (and suffering the consequences thereof)
- If the type system infers some of the (PLW - P) bad contexts, should it be allowed to prevent us from attempting such usage.
- Can the type system be explicitly informed of particular contexts by the programmer (trust the human etc) and then enforce them thereafter.
The Liskov/Wing subtype is a noble goal. But 1/2/3 ask very serious questions about its practical application.
> Indeed, I'd bet you could construct a Godelian paradox.
Completeness and decidability are the ultimate arbiters of proof systems. But fortunately there is a large enough world of s/w systems for which the limits are never ever going to be reached.
Regards,
Steven Perryman
Received on Fri Feb 22 2008 - 19:21:48 CET