home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!opl.com!regina!harvey
- From: harvey@opl.com (Harvey Reed)
- Newsgroups: comp.lang.c++
- Subject: Re: C++ maintenance
- Message-ID: <harvey.728009429@regina>
- Date: 26 Jan 93 00:50:29 GMT
- References: <C1BnAy.C3F@geovision.gvc.com>
- Sender: news@opl.com
- Distribution: na
- Lines: 58
-
- djb@geovision.gvc.com (Darren Burns) writes:
-
-
- >...
- >it does, but I'm not terribly familiar with the code. In a member
- >function I see:
-
- >int the_class::do_something ( )
- >{
- >...
- > foo->xxx();
- >...
- >}
-
- >Now, I'm browsing through this code and I'm thinking maybe the bug I'm
- >looking for is in xxx(). I want to take a look at it. In order to know
- >which xxx to look at (since there may be many classes that have xxx), I
- >need to know what class foo is. But foo could be a global variable,
- >a member of the_class, or a variable local to the function. I have to
- >hunt all over the place just to find out where to look for xxx.
-
- >I find this a real pain. I'm not experienced with C++, so maybe it's
- >something you get used to. I think that it's a general problem with
- >...
-
- Well, that can be a problem. One workaround for C++ (and maybe
- other languages) is to use naming conventions.
-
- For example, our conventions require:
-
- m<name> (m)ember data of a class
- s<name> (s)tatic data of a class
- a<name> (a)ctual parameter to a method
-
- and so on for data members. Other conventions for other names. In this
- way, the name carries some context, so in a method you know:
-
- m<name> and s<name> refers to members of the class that the method
- belongs to, so you can look in that header. a<name> means you can
- look in the signature for the method and see the type (class) there.
-
- Short of using a naming convention, it is difficult to keep track
- of what a name means. This may be where the experience level of
- the author(s) come into play. Folks that have a lot of road time
- with C++ tend to put some context in names.
-
- I'm sure others have good suggestions in this area too! I'm looking
- forward to see responses from your posting.
-
-
-
-
-
- --
- ++harvey
- ===========================================================================
- internet: harvey@opl.com / hreed@cs.ulowell.edu / h.reed@ieee.org
- voice/fax: 617-965-0220 / 617-965-7599
-