Re: A Design Problem
- From: "Daniel T." <daniel_t@xxxxxxxxxxxxx>
- Date: Sat, 25 Aug 2007 10:05:25 -0400
"Dmitry A. Kazakov" <mailbox@xxxxxxxxxxxxxxxxx> wrote:
On Fri, 24 Aug 2007 16:35:36 -0400, Daniel T. wrote:
Nick Keighley <nick_keighley_nospam@xxxxxxxxxxx> wrote:
Tool class will have all the methods which can be called on
at least one type of tool and have the default
implementation which will just throw some exception.
ah. that frightened me as well. I was thinking a do-nothing
method instead was a good idea, but apparently not.
A do-nothing method is perfectly acceptable, and IMHO preferred.
Just keep in mind, this means the method can have no
post-condition (strictly speaking the post-condition is "true".)
No, this is the postcondition of an implementation for this
*specific* type. The postcondition of the class, will not be
satisfied that easily. Compare this with multiplication by a number.
If the multiplicand is 0 you need not to do anything to get the
result. But this does not mean that it would be same for all other
numbers. Multiplication has "non-trivial" sense even, if it
occasionally is idempotent in 0.
Sorry, your example doesn't make any sense to me, but I can speak to
your generalization.
If objects of type T have a method M, and that method has the
post-condition TRUE, then the only thing *any* object of that type
(including sub-types of that type) need do when sent the message M is to
return control to the sender. Nothing else is required of them, and it
is improper for the sender of the message to expect anything more. Of
course they may do much more than that if they choose, but the sender of
the message has no right to *expect* them to.
The natural question then becomes, why bother calling such a
method? You see, the purpose of the method changes in this case.
You are calling the method to inform the object of something,
rather than to get it to do something.
Uhm, what is semantic difference between "doing" and "being
informed"? I bet there is no one. The postcondition of the method is
"yes sir! Informed, sir!" I suggest that an informed object differs
to an uniformed one. At least it should accept "I told you so."
Otherwise there were really no sense in having this method.
"When I tell you to do something, I expect you to do it." When object A
tells object B to do X, there is an implied master/slave relationship.
When such a relationship exists, B's responsibility for its own state is
reduced.
.
- Follow-Ups:
- Re: A Design Problem
- From: Dmitry A. Kazakov
- Re: A Design Problem
- References:
- A Design Problem
- From: Mousam
- Re: A Design Problem
- From: H. S. Lahman
- Re: A Design Problem
- From: Nick Keighley
- Re: A Design Problem
- From: Daniel T.
- Re: A Design Problem
- From: Dmitry A. Kazakov
- A Design Problem
- Prev by Date: Help in class diagram building
- Next by Date: Re: A Design Problem
- Previous by thread: Re: A Design Problem
- Next by thread: Re: A Design Problem
- Index(es):
Relevant Pages
|