Re: Objective criticism of inheritance
- From: Robert C. Martin <unclebob@xxxxxxxxxxxxxxxx>
- Date: Sun, 10 Apr 2005 12:58:01 -0500
On Wed, 06 Apr 2005 22:33:01 -0700, Dave Benjamin
<dave.benjamin@xxxxxxxxx> wrote:
>If we can consider "ifTrue" and friends to be equivalent to an
>if-statement in a programming language that doesn't anthropomorphize the
>boolean, can we likewise consider dispatch equivalent to switch/case and
>just get over it already? Because it seems to me that all switch/case
>needs to satisfy the critics is exhaustiveness checking, which is a
>programming language issue.
No, that's really not the issue. The issue is that a switch statement
*knows* every possible outcome and has a hard source code dependency
on each one. Whereas polymorphic dispatch knows *none* of the
possible outcomes and has no dependency of any kind on them.
To say this a different way, the outcomes of the switch statement have
to be in the same DLL as the switch statement. The outcomes of
polymorphism can be in completely different DLLs -- even DLLs that
weren't written at the time that the polymorphic DLL was built.
-----
Robert C. Martin (Uncle Bob) | email: unclebob@xxxxxxxxxxxxxxxx
Object Mentor Inc. | blog: www.butunclebob.com
The Agile Transition Experts | web: www.objectmentor.com
800-338-6716
"The aim of science is not to open the door to infinite wisdom,
but to set a limit to infinite error."
-- Bertolt Brecht, Life of Galileo
.
- Follow-Ups:
- Re: Objective criticism of inheritance
- From: Dave Benjamin
- Re: Objective criticism of inheritance
- References:
- Objective criticism of inheritance
- From: Duck Dodgers
- Re: Objective criticism of inheritance
- From: Shayne Wissler
- Re: Objective criticism of inheritance
- From: Duck Dodgers
- Re: Objective criticism of inheritance
- From: Shayne Wissler
- Re: Objective criticism of inheritance
- From: Duck Dodgers
- Re: Objective criticism of inheritance
- From: Phlip
- Re: Objective criticism of inheritance
- From: Dave Benjamin
- Re: Objective criticism of inheritance
- From: Phlip
- Re: Objective criticism of inheritance
- From: Dave Benjamin
- Objective criticism of inheritance
- Prev by Date: Re: Something about ACTIVE OBJECT pattern
- Next by Date: Re: Complex application flow. Best approach ???
- Previous by thread: Re: Objective criticism of inheritance
- Next by thread: Re: Objective criticism of inheritance
- Index(es):
Relevant Pages
|