--=-8ATCcdtClfT3OTXr4aSU
Content-Type: multipart/alternative; boundary="=-a5Y6GSRzGWi4pCIIf3nq"
--=-a5Y6GSRzGWi4pCIIf3nq
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
I'd say it should be avoided 98% of the time (MI). Inheritance in
general, is probably overused by at least 50%. (Most is-a
relationships aren't useful ones and are caused by people who aren't
used to thinking of OOP in other terms. I'm not suggesting this for
you, but is-a has a lot of implications that has-a doesn't. Therefore,
it's not "you-should-not-use-inheritance crap", it's sound advice from
years in the industry.)
Going back to the original model that sparked this: inheritance reflects
an "is-a" relationship. Someone wants to make an application object
that:
1. IS-A Linux application; and
2. IS-A video player application.
What stymies me here is... exactly which runtime is this going to be
running in where you can plug in a Linux application, a Windows
application or a ... Symbian, say, application and need the transparent
dispatching to the right functionality? Just the "LinuxApplication"
class by itself makes me suspicious of the model behind it: what useful
abstraction do you get from this that you don't get from an
"Application" that has a "POSIXFileSystem" (instead of "NTFSFileSystem")
and a "LinuxSecurityModel" (instead of "NTSecurityModel") or whatever?
Just this core has me scratching my head.
Adding the "VideoPlayerApplication" to the mix only raises even more
questions, all related, once again, to the nature of a runtime where you
need transparent dispatching to a VideoPlayerApplication over ... what,
exactly? A VideoRecorderApplication? An AudioPlayerApplication? A
RealTimeAutomobileAssembleyApplication?
Basically, I'm failing to see any useful "IS-A" relationships at all in
the original poster's model barring an awfully convoluted run-time with
some questionable approaches to things built into it. What he's viewing
as inheritance (IS-A) situations to me look like composition (HAS-A)
situations.
And this is what strikes me about most C++ code: people using IS-A left,
right and centre because that's what the language supports best; C++ is
positively lousy at supporting HAS-A relationships (and Java isn't much
better).
--=20
Michael T. Richter <
[email protected]> (GoogleTalk:
(e-mail address removed))
A well-designed and humane interface does not need to be split into
beginner and expert subsystems. (Jef Raskin)
--=-a5Y6GSRzGWi4pCIIf3nq
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; CHARSET=3DUTF-8">
<META NAME=3D"GENERATOR" CONTENT=3D"GtkHTML/3.12.1">
</HEAD>
<BODY>
On Sun, 2007-07-10 at 07:21 +0900, Austin Ziegler wrote:
<BLOCKQUOTE TYPE=3DCITE>
<PRE>
<FONT COLOR=3D"#000000">I'd say it should be avoided 98% of the time (MI). =
Inheritance in</FONT>
<FONT COLOR=3D"#000000">general, is probably overused by at least 50%. (Mos=
t is-a</FONT>
<FONT COLOR=3D"#000000">relationships aren't useful ones and are caused by =
people who aren't</FONT>
<FONT COLOR=3D"#000000">used to thinking of OOP in other terms. I'm not sug=
gesting this for</FONT>
<FONT COLOR=3D"#000000">you, but is-a has a lot of implications that has-a =
doesn't. Therefore,</FONT>
<FONT COLOR=3D"#000000">it's not "you-should-not-use-inheritance crap&=
quot;, it's sound advice from</FONT>
<FONT COLOR=3D"#000000">years in the industry.)</FONT>
</PRE>
</BLOCKQUOTE>
<BR>
Going back to the original model that sparked this: inheritance reflects an=
"is-a" relationship. Someone wants to make an application =
object that:
<OL TYPE=3D1>
<LI TYPE=3D1 VALUE=3D1>IS-A Linux application; and
<LI TYPE=3D1 VALUE=3D2>IS-A video player application.
</OL>
<BR>
What stymies me here is... exactly which runtime is this going to be runnin=
g in where you can plug in a Linux application, a Windows application or a =
... Symbian, say, application and need the transparent dispatching to the r=
ight functionality? Just the "LinuxApplication" class by it=
self makes me suspicious of the model behind it: what useful abstraction do=
you get from this that you don't get from an "Application" that =
has a "POSIXFileSystem" (instead of "NTFSFileSystem"
a=
nd a "LinuxSecurityModel" (instead of "NTSecurityModel"=
) or whatever? Just this core has me scratching my head.<BR>
<BR>
Adding the "VideoPlayerApplication" to the mix only raises even m=
ore questions, all related, once again, to the nature of a runtime where yo=
u need transparent dispatching to a VideoPlayerApplication over ... what, e=
xactly? A VideoRecorderApplication? An AudioPlayerApplication?&=
nbsp; A RealTimeAutomobileAssembleyApplication?<BR>
<BR>
Basically, I'm failing to see any useful "IS-A" relationships at =
all in the original poster's model barring an awfully convoluted run-time w=
ith some questionable approaches to things built into it. What he's v=
iewing as inheritance (IS-A) situations to me look like composition (HAS-A)=
situations.<BR>
<BR>
And this is what strikes me about most C++ code: people using IS-A left, ri=
ght and centre because that's what the language supports best; C++ is posit=
ively <B>lousy</B> at supporting HAS-A relationships (and Java isn't much b=
etter).<BR>
<BR>
<TABLE CELLSPACING=3D"0" CELLPADDING=3D"0" WIDTH=3D"100%">
<TR>
<TD>
-- <BR>
<B>Michael T. Richter</B> <<A HREF=3D"mailto:
[email protected]">ttmri=
(e-mail address removed)</A>> (<B>GoogleTalk:</B> (e-mail address removed))<BR>
<I>A well-designed and humane interface does not need to be split into begi=
nner and expert subsystems. (Jef Raskin)</I>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
--=-a5Y6GSRzGWi4pCIIf3nq--
--=-8ATCcdtClfT3OTXr4aSU
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
iD8DBQBHCGryLqyWkKVQ54QRApPgAJ4iAujVDnsv3M9JhzEAbTQ3uLLEpgCaAo/p
LLqZveVwGD4fZ460VmoPUoU=
=pz5Z
-----END PGP SIGNATURE-----
--=-8ATCcdtClfT3OTXr4aSU--