home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / cplus / 19890 < prev    next >
Encoding:
Internet Message Format  |  1993-01-25  |  2.2 KB

  1. Path: sparky!uunet!opl.com!regina!harvey
  2. From: harvey@opl.com (Harvey Reed)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: C++ maintenance
  5. Message-ID: <harvey.728009429@regina>
  6. Date: 26 Jan 93 00:50:29 GMT
  7. References: <C1BnAy.C3F@geovision.gvc.com>
  8. Sender: news@opl.com
  9. Distribution: na
  10. Lines: 58
  11.  
  12. djb@geovision.gvc.com (Darren Burns) writes:
  13.  
  14.  
  15. >...
  16. >it does, but I'm not terribly familiar with the code.  In a member
  17. >function I see:
  18.  
  19. >int the_class::do_something ( )
  20. >{
  21. >...
  22. >    foo->xxx();
  23. >...
  24. >}
  25.  
  26. >Now, I'm browsing through this code and I'm thinking maybe the bug I'm
  27. >looking for is in xxx().  I want to take a look at it.  In order to know
  28. >which xxx to look at (since there may be many classes that have xxx), I
  29. >need to know what class foo is.  But foo could be a global variable,
  30. >a member of the_class, or a variable local to the function.  I have to
  31. >hunt all over the place just to find out where to look for xxx.
  32.  
  33. >I find this a real pain.  I'm not experienced with C++, so maybe it's
  34. >something you get used to.  I think that it's a general problem with
  35. >...
  36.  
  37. Well, that can be a problem. One workaround for C++ (and maybe 
  38. other languages) is to use naming conventions.
  39.  
  40. For example, our conventions require:
  41.  
  42. m<name>       (m)ember data of a class
  43. s<name>       (s)tatic data of a class
  44. a<name>       (a)ctual parameter to a method
  45.  
  46. and so on for data members. Other conventions for other names. In this
  47. way, the name carries some context, so in a method you know:
  48.  
  49. m<name> and s<name> refers to members of the class that the method
  50. belongs to, so you can look in that header. a<name> means you can
  51. look in the signature for the method and see the type (class) there.
  52.  
  53. Short of using a naming convention, it is difficult to keep track
  54. of what a name means. This may be where the experience level of
  55. the author(s) come into play. Folks that have a lot of road time
  56. with C++ tend to put some context in names.
  57.  
  58. I'm sure others have good suggestions in this area too! I'm looking
  59. forward to see responses from your posting.
  60.  
  61.  
  62.  
  63.  
  64.  
  65. -- 
  66. ++harvey
  67. ===========================================================================
  68. internet:       harvey@opl.com  /  hreed@cs.ulowell.edu  /  h.reed@ieee.org
  69. voice/fax:      617-965-0220    /  617-965-7599
  70.