From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,d95b511473b3a931 X-Google-Attributes: gid109fba,public X-Google-Thread: 1014db,d95b511473b3a931 X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,d95b511473b3a931 X-Google-Attributes: gid103376,public From: steidl@centuryinter.net Subject: Re: Language Choice and Coding style Date: 1996/07/03 Message-ID: <4re0la$qk6@news.ld.centuryinter.net>#1/1 X-Deja-AN: 163591309 references: organization: Century Internet reply-to: steidl@centuryinter.net newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++ Date: 1996-07-03T00:00:00+00:00 List-Id: In , nasser@apldbio.com (Nasser Abbasi) writes: > > From: maggior@world2u.com (Rich Maggio) > > Though things like Hungarian notation are cumbersome, I think there is > definitely a need for it. > >I dont think there is a need for it. It makes the code harder to read >to start with, and it does not add anything to understanding the >algorithm itself. IMHO. Hungarian notation seems self-contradictory to me. Its proponents claim that it is a part of good coding style (or at least most of them do ;-)). Its purpose is to make it easy to tell at a glance what a variable's type is. The underlying assumption, then, seems to be that there are just too many variables for the reader of the program to keep track of and/or the definition of the variable is too far away to be quickly glanced at. If either or both of these is the case, isn't it very likely that the code is in bad need of decomposition? (I.e., another part of good coding style is being ignored?) [I suppose another case for hungarian notation would be for global variables, since the definition of the variable is - by definition :) - not local. But then that would just be another violation of generally accepted good coding style.] I *might* be able to see an argument for the use of hungarian notation for functions, since most development environments do not let you easily glance it its definition. (But even for functions, I would still not personally want to use hungarion notation - I would rather buy/build a better editor which *does* let you view the definition at a glance). Of course, what would be really cool is if a code editor had an option that let you turn type-info on and off (i.e. it would space out your code a little more so that it could display the type of every variable and function just below its use) - since I think that would make both camps happy. (Or you could use Xerox PARC's "lens" idea for this.) Can someone come up with a case where: 1. hungarian notation is needed for variables 2. (1) is not solved by some other common good coding style method 3. the case is not ultra-specific (i.e. it justifies hungarian notation as being a general good coding style method) -Jeff BTW, I tend to declare things in alphabetical order for just this reason - to keep it down to a glance instead of an O(N) search.