comp.lang.ada
 help / color / mirror / Atom feed
From: Dave Toland <det@platsol.com>
Subject: Re: Hungarian notation
Date: 1996/05/24
Date: 1996-05-24T00:00:00+00:00	[thread overview]
Message-ID: <31A5B15E.321F@platsol.com> (raw)
In-Reply-To: 4o35bu$ut8@sol.caps.maine.edu


slary61@maine.maine.edu wrote:
| dewar@cs.nyu.edu (Robert Dewar) wrote:
| > Hungarian notation is certainly a remarkable demonstration of how few people
| > have learned and understood data abstraction. What's most interesting is
| > how difficult it is for its advocates to see this point, but I suppose that
| > is not surprising. If you never understood what abstraction is about, then
| > of course adopting a notation that destroys it will not concern you.
| 
| Perhaps Bill Gates will be contacting you for that explanation.
| Although the examples you cite support your opinion, the bottom
| line is that some of the largest software developers in the world
| insist on code using Hungarian Notation.
| 
| Why?

Biggest or most doesn't necessarily mean correct.  Hungarian notation has some
advantages, but keep in mind it was developed for C, not C++.  C is a procedural
language, and programs written in it have long been plagued by problems with
mismatches of fundamental data types.  The addition of function prototypes to
the language did much to ameliorate the problem for call interfaces, except for
functions like printf for which compile time checking is not possible *in the
general case* (yes, I know gcc can check printf calls, but only because the compiler
has special knowledge of that runtime routine).  And prototypes can only diagnose
mismatches for invariant argument lists if they are consistently used.  ANSI C
only requires prototypes for variable argument list functions, and in fact a large
body of code cannot use prototypes without tedious macro magic because it must
compile on platforms for which ANSI compilers are not or were not available.
This is where Hungarian notation can help compensate for the failures of the
language.

But C++ is an object oriented language.  Despite its ancestry, its philosophy is
completely different than that of C.  One of the key principles is to hide the
implementation details of the data and to deal instead with the data's abstract
properties.  The very *last* thing you want to do in that paradigm is name your
variables in a way that emphasizes their underlying implementation.

As for me, I've been practicing data abstraction in my C coding for over ten years,
so I've held a certain distaste for Hungarian notation for all that time as well.
I am very aware of the shortcomings of C in terms of type checking, but rather than
constraining variable names, I have favored instead a liberal use of typedefs to
form abstract data types.  I still need to know the underlying types for some
purposes, such as displaying with the printf family, but I try to encapsulate
the code that knows the internal format as much as possible.  I try to minimize
the lifetime and scope of variables, and the longer the lifetime, the more careful
I am in the naming of the variable.  So "i" is an appropriate name for a variable
used an an index for a 3-line iteration, and "CurrentSourceFileInfo" is an
appropriate name for a global structure (if it really must be global) used for
all operations on the source file presently open.

Imposing arbitrary rules results in code every bit as opaque as without the rules.
Teaching good judgement results in maintainable code.  Informed peer review of
code can point out poor name selection and treat it as the defect that it is.

-- 
I protest!  I am *NOT* a Merry Man!
Dave Toland       Platinum Solutions, Inc.    det@platsol.com




  reply	other threads:[~1996-05-24  0:00 UTC|newest]

Thread overview: 227+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4adem2$b5s@mercury.IntNet.net>
     [not found] ` <4ahka7$o9m@inrou.erno.de>
1996-05-13  0:00   ` Hungarian notation Roger Merritt
1996-05-14  0:00     ` The Right Reverend Colin James III
1996-05-15  0:00       ` Graham Perkins
1996-05-15  0:00         ` Peter Seebach
1996-05-16  0:00           ` Pete Becker
1996-05-14  0:00     ` David Priest
1996-05-14  0:00     ` Keith Whittingham
1996-05-14  0:00       ` Dr S.J. Harris
1996-05-15  0:00         ` Gerolf Wendland
1996-05-16  0:00           ` mAg
1996-05-17  0:00             ` Arne W Flones
1996-05-21  0:00               ` Norman L. Reitzel   
1996-05-21  0:00                 ` Bob Rodgers
1996-05-22  0:00                   ` Matt Kennel
1996-05-23  0:00                     ` Bob Rodgers
1996-05-23  0:00                       ` Peter Seebach
1996-05-23  0:00                     ` Steve Willer
1996-05-23  0:00                       ` Richard A. O'Keefe
1996-05-23  0:00                         ` Steve Willer
1996-05-22  0:00                   ` Michael Furman
1996-05-22  0:00                   ` Slander (was: Hungarian notation) Graham Perkins
1996-05-23  0:00                     ` Richard A. O'Keefe
1996-05-24  0:00                       ` Tucker Taft
1996-05-23  0:00                   ` Hungarian notation Peter Moylan
1996-05-21  0:00                 ` Richard A. O'Keefe
1996-05-22  0:00                   ` Peter Moylan
1996-05-23  0:00                     ` Robert Dewar
1996-05-23  0:00                       ` Steve Willer
1996-05-28  0:00                         ` Richard A. O'Keefe
1996-05-29  0:00                           ` Kevin Cline
1996-05-24  0:00                       ` Kevin Cline
1996-05-25  0:00                         ` Steve Willer
1996-05-25  0:00                           ` Hungarian notation: the thread of choice for consummate boors The Right Reverend Colin James III
1996-05-27  0:00                             ` Ken Nicolson
     [not found]                             ` <HFsHoD96w165w@bwalk.dm.com>
1996-05-28  0:00                               ` Jon Hornstein
1996-06-05  0:00                         ` Hungarian notation Ralph Silverman
1996-06-06  0:00                           ` Richard A. O'Keefe
1996-06-06  0:00                           ` James McKim
1996-06-07  0:00                             ` Ralph Silverman
1996-05-24  0:00                       ` Jeff Dege
1996-05-26  0:00                       ` Warren Young
1996-05-23  0:00                     ` Andy Ho-Fan Chan
1996-05-23  0:00                       ` Robert Dewar
1996-05-24  0:00                         ` Bob Rodgers
1996-05-24  0:00                         ` Robert A Duff
1996-05-28  0:00                           ` Richard A. O'Keefe
1996-05-28  0:00                             ` Jeff Dege
1996-05-28  0:00                             ` Janus
1996-05-29  0:00                             ` Chris Kuan
1996-05-29  0:00                               ` Bob Rodgers
1996-05-30  0:00                                 ` Chris Kuan
1996-05-29  0:00                             ` Michael Furman
1996-05-31  0:00                               ` Richard A. O'Keefe
1996-05-31  0:00                                 ` Commenting (was Re: Hungarian notation) Alan Bowler
1996-05-31  0:00                                   ` Robert Dewar
1996-06-03  0:00                                     ` Ken Garlington
1996-06-01  0:00                                 ` Hungarian notation Warren Young
1996-06-01  0:00                                 ` Steve Willer
1996-06-03  0:00                                   ` Warren Young
1996-05-31  0:00                             ` Will Rose
1996-06-05  0:00                               ` Ralph Silverman
1996-06-07  0:00                                 ` Michael Furman
1996-06-01  0:00                             ` Heinz Hemken
1996-06-02  0:00                               ` Matt Kennel
1996-06-02  0:00                               ` Jeff Dege
1996-06-05  0:00                               ` Ralph Silverman
1996-06-06  0:00                                 ` Jeff Dege
1996-05-27  0:00                       ` Peter Moylan
1996-05-27  0:00                         ` Jeff Dege
1996-05-27  0:00                           ` The Amorphous Mass
1996-05-28  0:00                             ` Jeff Dege
1996-05-28  0:00                               ` The Amorphous Mass
1996-05-29  0:00                               ` Comments was: " Bob Lang 3P21 x3172
1996-05-30  0:00                                 ` Kevin Cline
     [not found]                           ` <4odgjh$6o@carrera.intergate.bc.ca>
1996-05-28  0:00                             ` try to run this! - try_me.exe [3/4] Otmar Conradus
1996-05-28  0:00                       ` Hungarian notation Richard A. O'Keefe
1996-05-31  0:00                         ` The Last Word on Comments (was Re: Hungarian notation) Clark L. Coleman
1996-06-03  0:00                           ` Robert A Duff
1996-06-13  0:00                             ` Kevin D. Quitt
1996-06-13  0:00                               ` Richard Riehle
1996-06-15  0:00                                 ` Train
1996-06-18  0:00                                 ` Sandy McPherson
1996-06-18  0:00                                   ` David Zink
1996-06-19  0:00                                     ` Michael Furman
1996-06-20  0:00                                       ` Robert Dewar
1996-06-23  0:00                                         ` David Zink
1996-06-23  0:00                                           ` Robert Dewar
1996-06-28  0:00                                         ` Ralph Silverman
1996-06-28  0:00                                           ` Robert Dewar
1996-07-11  0:00                                             ` Ralph Silverman
1996-07-11  0:00                                               ` Robert Dewar
1996-07-12  0:00                                               ` steidl
1996-07-12  0:00                                                 ` Peter Seebach
1996-07-12  0:00                                                 ` Robert Dewar
1996-06-29  0:00                                           ` Lawrence Kirby
1996-06-29  0:00                                           ` steidl
1996-06-20  0:00                                   ` The Last Word on Comments (was Re: Hun Ian Ward
1996-06-05  0:00                           ` The Last Word on Comments (was Re: Hungarian notation) Peter Moylan
1996-06-05  0:00                             ` Mike Fulton
1996-06-05  0:00                               ` Shane Badham
1996-06-13  0:00                                 ` Steve Sobol
1996-06-14  0:00                                   ` Re-designing CS (long) (Was: Re: The Last Word on Comments) Warren Young
1996-06-21  0:00                                   ` Re-designing CS (long) Warren Young
1996-06-24  0:00                                     ` Brian J. Quandt
1996-06-05  0:00                               ` The Last Word on Comments (was Re: Hungarian notation) Steve Howard
1996-06-06  0:00                                 ` Jeff Dege
1996-06-06  0:00                               ` Bob Lang 3P21 x3172
1996-06-08  0:00                             ` Bill Hay
1996-06-11  0:00                               ` Derek Lee Beatty
1996-06-11  0:00                           ` Darius Blasbans
1996-06-11  0:00                           ` Darius Blasbans
1996-06-11  0:00                           ` Darius Blasbans
1996-06-11  0:00                           ` Darius Blasbans
1996-06-11  0:00                           ` Darius Blasbans
1996-06-11  0:00                             ` Kevin J. Weise
1996-06-13  0:00                               ` Kevin Cline
1996-06-13  0:00                               ` Kevin D. Quitt
1996-06-12  0:00                             ` Robert Dewar
1996-06-17  0:00                               ` James McKim
1996-06-18  0:00                                 ` Robert Dewar
1996-06-06  0:00                       ` Hungarian notation Ralph Silverman
1996-06-06  0:00                         ` David Hopkins
1996-06-07  0:00                         ` Richard A. O'Keefe
1996-06-07  0:00                           ` Steve Willer
1996-06-10  0:00                             ` Michael Furman
1996-06-12  0:00                               ` Warren Young
1996-06-07  0:00                         ` Hungarian notation (an aside) Bob Lang 3P21 x3172
1996-06-06  0:00                       ` Hungarian notation Sam Hunting
1996-06-11  0:00                       ` I wish it was "The Last Word on Comments (was Re: Hungarian notation)" Blair MacIntyre
1996-06-03  0:00                     ` Hungarian notation Norman H. Cohen
1996-06-10  0:00                 ` Ralph Silverman
1996-05-18  0:00             ` Richard Riehle
1996-05-23  0:00             ` Laurent Guerby
1996-05-23  0:00               ` Please keep Hungarian notation thread OUT of comp.lang.modula3 Tim Mann
1996-05-23  0:00             ` Hungarian notation Robert I. Eachus
1996-05-23  0:00             ` James Kanze US/ESC 60/3/141 #40763
1996-05-23  0:00               ` Paul J. Kossick
1996-05-25  0:00                 ` Raoul De Kezel
1996-06-05  0:00             ` Ralph Silverman
1996-06-05  0:00               ` jthorpe
1996-06-06  0:00               ` Richard A. O'Keefe
1996-06-07  0:00                 ` Chris Kuan
1996-06-07  0:00                 ` Ralph Silverman
1996-06-07  0:00                   ` The Amorphous Mass
1996-06-10  0:00                   ` Michael Furman
1996-06-11  0:00                   ` Richard A. O'Keefe
1996-06-11  0:00                     ` Will Rose
1996-06-11  0:00                     ` Kevin Cline
1996-06-11  0:00                       ` Chris Engebretson
1996-06-11  0:00                       ` Ralph Silverman
1996-06-12  0:00                       ` Bob Rodgers
1996-06-12  0:00                         ` Matt Kennel
1996-06-13  0:00                           ` Jeff Dege
1996-06-13  0:00                           ` Giuliano Carlini
1996-06-22  0:00                       ` Richard Green
1996-06-05  0:00           ` Ralph Silverman
1996-05-14  0:00       ` Peter Seebach
1996-05-14  0:00         ` Pete Becker
     [not found]           ` <4ndb2j$1p0q@uni.library.ucla.edu>
1996-05-16  0:00             ` Mark Chu-Carroll
1996-05-16  0:00               ` Jay Martin
1996-05-17  0:00                 ` Scott
1996-05-23  0:00                 ` G.O.Visser
1996-05-16  0:00             ` Scott
1996-05-16  0:00               ` Giuliano Carlini
1996-05-18  0:00                 ` Warren Young
1996-05-16  0:00             ` Steve Branam
1996-05-16  0:00         ` Matt Kennel
1996-05-14  0:00       ` Dave Mikesell
1996-05-16  0:00       ` Dave Toland
1996-05-21  0:00       ` mAg
1996-05-21  0:00         ` Peter Seebach
1996-05-23  0:00           ` Steve Willer
1996-05-23  0:00             ` Robert Dewar
1996-05-24  0:00               ` slary61
1996-05-24  0:00                 ` Dave Toland [this message]
1996-05-24  0:00                 ` Jerry Kuch
1996-05-24  0:00                 ` Jeff Dege
1996-05-24  0:00                 ` Jos A. Horsmeier
1996-05-26  0:00                   ` Richard Riehle
1996-05-27  0:00                     ` Warren Young
1996-06-03  0:00                     ` Eva
1996-05-28  0:00                   ` Paul D. DeRocco
1996-05-24  0:00                 ` Ian Ward
1996-05-27  0:00                 ` Norman L. Reitzel   
1996-05-27  0:00                   ` Matt Kennel
1996-05-28  0:00                 ` Richard A. O'Keefe
1996-05-28  0:00                   ` Jay Martin
1996-05-29  0:00                     ` Richard A. O'Keefe
1996-06-01  0:00                     ` Michael Feldman
1996-05-29  0:00                 ` AJ Musgrove
1996-06-05  0:00                 ` Ralph Silverman
1996-06-06  0:00                 ` Ralph Silverman
1996-05-24  0:00               ` Steve Willer
1996-05-23  0:00             ` Richard A. O'Keefe
1996-05-23  0:00               ` Robert Dewar
1996-05-28  0:00                 ` Richard A. O'Keefe
1996-05-23  0:00               ` Bob Rodgers
1996-05-23  0:00                 ` Bob Kitzberger
1996-05-23  0:00               ` Train
1996-05-23  0:00                 ` jeffos2
1996-05-23  0:00             ` Peter Seebach
1996-05-21  0:00         ` Bob Lang 3P21 x3172
1996-05-21  0:00         ` Mark A Biggar
1996-05-21  0:00           ` slary61
1996-05-24  0:00         ` Oleg Kagan
1996-06-05  0:00           ` Ralph Silverman
1996-05-23  0:00     ` James Kanze US/ESC 60/3/141 #40763
1996-05-28  0:00     ` Brian Rogoff
1996-05-28  0:00     ` Homonnai Misi
1996-05-20  0:00   ` James Kanze US/ESC 60/3/141 #40763
1996-05-20  0:00     ` Tom Wheeley
1996-05-23  0:00     ` Steve Willer
1996-05-22  0:00   ` James Kanze US/ESC 60/3/141 #40763
1996-05-23  0:00   ` James Kanze US/ESC 60/3/141 #40763
1996-05-23  0:00     ` Richard Kenner
1996-06-01  0:00   ` Jim Kingdon
1996-06-10  0:00 Bob Crispen
  -- strict thread matches above, loose matches on Subject: below --
1996-05-15  0:00 Bob Crispen
     [not found] <30C40F77.53B5@swsbbs.com>
     [not found] ` <marnoldDJEvtJ.1Lx@netcom.com>
     [not found]   ` <4aleun$jlk@ns.RezoNet.NET>
     [not found]     ` <marnoldDJMDBG.CFz@netcom.com>
     [not found]       ` <4asnkr$7b0@solutions.solon.com>
     [not found]         ` <4ath75$e7i@barnacle.iol.ie>
     [not found]           ` <4b4kij$svt@news.microsoft.com>
     [not found]             ` <dewar.819489496@schonberg>
1996-01-08  0:00               ` Michael Feathers
     [not found]               ` <4bd <4cne0e$1020@seminole.gate.net>
1996-01-08  0:00                 ` Bob Kitzberger
1996-01-08  0:00                 ` Adam Beneschan
     [not found] ` <30EF0415.6FE1@tus.ssi1.com>
     [not found]   ` <1996Jan7.045815.8676@ohstpy>
     [not found]     ` <4cpb00$nqk@news.xmission.com>
1996-01-08  0:00       ` Michael Feathers
1996-01-08  0:00         ` vancleef
1996-01-09  0:00         `  Todd Knarr 
1996-01-09  0:00           ` Michael Feathers
     [not found]       ` <hawkfish-0801960904580001@blv-pm3-ip24.halcyon.com>
1996-01-09  0:00         `  Todd Knarr 
     [not found] ` <4cd8fc$oud@news.manawatu.gen.nz>
1996-01-08  0:00   ` Joachim Durchholz
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox