Re: Question on LSP
- From: "S Perryman" <a@xxxxx>
- Date: Wed, 19 Apr 2006 08:37:46 +0100
"Daniel T." <postmaster@xxxxxxxxxxx> wrote in message
news:postmaster-772BB0.13224118042006@xxxxxxxxxxxxxxxxxxxxxxxxxx
In article <e22p23$1o7$1@xxxxxxxxxxxxx>, "S Perryman" <a@xxxxx> wrote:
"Daniel T." <postmaster@xxxxxxxxxxx> wrote in message
news:postmaster-3417BD.08305818042006@xxxxxxxxxxxxxxxxxxxxxxxxxx
Even if they put the try catch block in, the programs behavior will
*still* change, which is against the principles of LSP.
The programs behaviour will indeed change, because it was *incorrect* .
The List contract states (albeit rather poorly) that
UnsupportedOperationException may be thrown if the add op is invoked
on a List instance. The component user is therefore obliged to deal with
this fact.
Even users who do deal with the exception will have the behavior of
their programs change. That is so obvious, I'm surprised I have to
mention it.
If the user has been dealing with the exception from the outset, their
behaviour
has not changed at all (obviously) . It is correct when a List instance
raises the
exception, and correct when the instance does not. The behaviour conforms to
the
List contract.
Which is in contrast to the behaviour user who ignores the contract as
defined
by List, and does not deal with the exception. It is correct when a List
instance
does not raise the exception, and *incorrect* when the instance does.
The only obvious thing here is that defective s/w has to change its
behaviour.
Specifically, change its behaviour to be *correct* .
And the fact remains that this example is not a case of DbC holding while
Liskov/
Wing subtyping does not. It is an example of a user completely ignoring a
component contract, and then complaining when their ignorance results in
their
s/w (and not the component suppliers' ) becoming defective.
Regards,
Steven Perryman
.
- Follow-Ups:
- Re: Question on LSP
- From: Daniel T.
- Re: Question on LSP
- References:
- Question on LSP
- From: hforco@xxxxxxxxxxxxxx
- Re: Question on LSP
- From: Dmitry A. Kazakov
- Re: Question on LSP
- From: Daniel T.
- Re: Question on LSP
- From: ggroups
- Re: Question on LSP
- From: Daniel T.
- Re: Question on LSP
- From: S Perryman
- Re: Question on LSP
- From: Daniel T.
- Re: Question on LSP
- From: S Perryman
- Re: Question on LSP
- From: Daniel T.
- Question on LSP
- Prev by Date: Re: sizeof in java
- Next by Date: UML Structured class with utility parts?
- Previous by thread: Re: Question on LSP
- Next by thread: Re: Question on LSP
- Index(es):
Relevant Pages
|