| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Clean Object Class Design -- Circle/Ellipse
> This definition of inheritance is in fact a LSP definition of a
> constrained subtype. If you define subtypes as LSP-subtypes, then yes,
> you can design Ellipse, so that no Circle cannot be made its subtype.
>
> >Hence a Circle derivation is not possible from the above Ellipse class.
>
> LSP-conform derivation.
>
> BTW your perfectly valid Ellipse is by no means perfect. What if
> setAxisA is called with the argument NaN? Will the result be an
> Ellipse? What if the argument is negative?
That's a cheap shot, you are just talking for the sake of talking. Add newA, newB > 0 to the preconditions. Then violating them will simply be a bug in the client side.Moreover if you are not going to conform to LSP, then use containment, not inheritance. Your argument by no means nullify my argument.
> When the postconditions are allowed to be violated for "true
> ellipses", then it should be allowed for a circle as well. Let's
> consider contract violation as a property in LSP sense (:-))
How can you rely on your software if you cannot satisfy the pre/post conditions? Received on Mon Aug 06 2001 - 03:39:09 CDT
![]() |
![]() |