home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / software / 4975 < prev    next >
Encoding:
Text File  |  1992-12-15  |  2.3 KB  |  68 lines

  1. Newsgroups: comp.software-eng
  2. Path: sparky!uunet!infonode!ingr!b30news!mueller
  3. From: mueller@b30news.b30.ingr.com ( Phil Mueller )
  4. Subject: Re: average identifier length (was Comments: Code...)
  5. Message-ID: <1992Dec15.131302.22615@b30.ingr.com>
  6. Sender: mueller@b30.ingr.com (Phil Mueller)
  7. Organization: Intergraph
  8. References: <1512@gistdev.gist.com> <12ea/11dbc@jspc.wimsey.bc.ca> <craigh.723767103@cserver>
  9. Distribution: na
  10. Date: Tue, 15 Dec 1992 13:13:02 GMT
  11. Lines: 55
  12.  
  13. In article <craigh.723767103@cserver> craigh@cserver.plexus.com (Craig Heilman) writes:
  14. >jonathan@jspc.wimsey.bc.ca (Jonathan Story) writes:
  15. >
  16. >>In article <1992Dec5.094805@eklektix.com>
  17. >>     rcd@raven.eklektix.com (Dick Dunn) writes:
  18. >>> marick@cs.uiuc.edu (Brian Marick) writes:
  19. >>> >Whether you use short or long names, as important as comprehensibility
  20. >>> >of correct code is avoiding incorrect code...
  21. >>> 
  22. >>> fair enough, but only cautious approval here...
  23. >>> 
  24. >>> >My advice is to use whatever identifier style you like: but make sure
  25. >>> >names are more than one typo away from other names in the same
  26. >>> >routine.  "i" and "j" are bad loop indices;...
  27. >>> 
  28. >>> No, they're not.  At the least, when you're writing code to implement
  29. >
  30. >>Yes, they are.  Granted, loop indices probably don't need long
  31. >>identifiers, but there is a second consideration: searching.  When you
  32. >>want to see where variable 'i' is used, you are going to get a number of
  33. >>false hits.  Recommendation: use 'ii', 'jj', etc.
  34. >
  35. >If you are using vi to look at your code then you can find all uses of
  36. >any "word" by specifying your search as \<word\>.  For example, to find
  37. >all uses of i you would say \<i\> (this search pattern can be specified
  38. >anywhere you would normally use a search pattern...).  This search will 
  39. >find all these i's:
  40. >
  41. >    long i;            
  42. >    for (i = 0; i < MAX; ++i)
  43. >    array[i] = ...
  44. >
  45. >but not these i's:
  46. >
  47. >    int j;
  48. >    /* this is a test */
  49. >    myVariableName
  50. >
  51. >Try it and see :-)
  52. >
  53.  
  54. So you're going to force everyone to use vi?
  55. AAAARRRRGGGGHHHH!!!!
  56.  
  57. I'm glad someone else uses the 'ii' technique.  Means that there's some
  58. code I may have to maintain someday that doesn't use 'i' <gag>.
  59.  
  60. To Craig:
  61.   If you got a mail message from me, sorry.  I typed 'R' instead of 'F'
  62.  
  63.  
  64.  
  65. -- 
  66. Phil Mueller    mueller@b30news.b30.ingr.com
  67. The preceeding opinions are not necessarily those of Intergraph Corporation.
  68.