🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.eiffel
Article #1145

Re: Hungarian notation

#1145
From: Michael Feathers
Date: Tue, 09 Jan 1996 12:56
47 lines
3033 bytes
Todd Knarr (tknarr@xmission.com) wrote:
: In <4crm6i$24mi@navajo.gate.net>, feathers@gate.net (Michael Feathers) writes:
: >I've never seen a variable that can be any of 9 different types in C++.
: >All variables have a type.  Period.  A type can be a union or a base 
: >class, but all variables have one and only one type in C++.  If you don't
: >believe me, check the ARM.
: 
: You haven't worked with polymorphic classes as reference arguments or
: pointers much, then. I have the following class heirarchy:

Yeah, I have.

In your example (deleted for space) you mention that a
reference can stand in place for objects of any of its derived types.

I said that all variables have one-and-only-one-type.  The reference
itself is a variable (as pointers are) and it has a type.

This may seem like a quibbling point, but in OOP it should be a natural
assumption (because of polymorphism) that all objects of derived
classes should perform in a manner appropriate to their class in
the context of their base classes interfaces.  This is information
hiding, in much the same way as function names hide implementation 
yet provide semantic information.  If this is not the case, then the 
inheritance should be suspect.

: Give me an HN prefix that tells me that, in the following prototype
: 
: Stall *HardwareChangeSignalled( Stall& ExistingStall, int ByteCount,
:                                 unsigned char *aHardwareData );
: 
: the ExistingStall argument is one of the 9 subclasses and never a Stall,
: and the returned pointer is one of the 9 subclasses and never a pointer to
: Stall.

Why never a Stall?  If Stall's interface is present in any of its derived
classes, Stall calls should be resolved.

: Without such a prefix, you can readily get the obnoxious situation of a new
: programmer depending on the prefix and not realizing that he is dealing with
: a polymorphic type. This can cause him problems if he refers to the source
: code for Stall, depending on the HN prefix to be the actual type.

True enough, but I think that new OOP programmers should drill it into
their heads that references==pointers as far as polymorphism goes (and
in other ways too).  Polymorphism has to change the way that you understand
code.  We are not in Kansas any more. 
Technical Details
Message-ID: <4ctomq$1pi8@hopi.gate.net>
Path: arc1-ca.pugleaf.net!gate.net!not-for-mail
References: <30C40F77.53B5@swsbbs.com> <30EF0415.6FE1@tus.ssi1.com> <1996Jan7.045815.8676@ohstpy> <4cpb00$nqk@news.xmission.com> <4crm6i$24mi@navajo.gate.net> <4csi2t$gsa@news.xmission.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!gate.net!not-for-mail
From: feathers@gate.net (Michael Feathers)
Newsgroups: comp.lang.eiffel,comp.lang.ada,comp.edu,comp.lang.c,comp.lang.c++,comp.lang.modula2,comp.lang.modula3
Subject: Re: Hungarian notation
Followup-To: comp.lang.eiffel,comp.lang.ada,comp.edu,comp.lang.c,comp.lang.c++,comp.lang.modula2,comp.lang.modula3
Date: 9 Jan 1996 07:56:58 -0500
Organization: CyberGate, Inc.
Message-ID: <4ctomq$1pi8@hopi.gate.net>
References: <30C40F77.53B5@swsbbs.com> <30EF0415.6FE1@tus.ssi1.com> <1996Jan7.045815.8676@ohstpy> <4cpb00$nqk@news.xmission.com> <4crm6i$24mi@navajo.gate.net> <4csi2t$gsa@news.xmission.com>
NNTP-Posting-Host: hopi.gate.net
X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]