home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / cplus / 19898 < prev    next >
Encoding:
Text File  |  1993-01-25  |  6.4 KB  |  137 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!brunix!brunix!sdm
  3. From: sdm@cs.brown.edu (Scott Meyers)
  4. Subject: Re: C++ maintenance
  5. Message-ID: <1993Jan26.031923.26651@cs.brown.edu>
  6. Sender: news@cs.brown.edu
  7. Organization: Brown University Department of Computer Science
  8. References: <C1BnAy.C3F@geovision.gvc.com> <harvey.728009429@regina>
  9. Distribution: na
  10. Date: Tue, 26 Jan 1993 03:19:23 GMT
  11. Lines: 124
  12.  
  13. In article <harvey.728009429@regina> harvey@opl.com (Harvey Reed) writes:
  14. | djb@geovision.gvc.com (Darren Burns) writes:
  15. | >...
  16. | >it does, but I'm not terribly familiar with the code.  In a member
  17. | >function I see:
  18. | >int the_class::do_something ( )
  19. | >{
  20. | >...
  21. | >    foo->xxx();
  22. | >...
  23. | >}
  24. | >Now, I'm browsing through this code and I'm thinking maybe the bug I'm
  25. | >looking for is in xxx().  I want to take a look at it.  In order to know
  26. | >which xxx to look at (since there may be many classes that have xxx), I
  27. | >need to know what class foo is.  But foo could be a global variable,
  28. | >a member of the_class, or a variable local to the function.  I have to
  29. | >hunt all over the place just to find out where to look for xxx.
  30.  
  31. | Well, that can be a problem. One workaround for C++ (and maybe 
  32. | other languages) is to use naming conventions.
  33.  
  34. Oh please.  If ever there were a job for a machine, looking up symbol
  35. definitions is that job.  Another poster mentioned browsers, but some
  36. browsers are not designed to answer the specific question that is put forth
  37. here, which is "Where in *(&*&! is the function xxx declared?"
  38.  
  39. One approach to the problem is to build a database with information about
  40. the program you're working on and to then add a database query interface to
  41. your favorite editor so that you can say to your editor, "take me to where
  42. xxx is declared," and your editor will promptly do so.  We built such a
  43. system here at Brown University, using the XREFDB database that is part of
  44. FIELD and adding a query interface to our favorite editor, which happens to
  45. be Emacs.   You can read all about it in the following paper, which, rumor
  46. has it, just appeared in the 12/92 issue of Transactions on Software
  47. Engineering:
  48.  
  49.   @ARTICLE{maintaining-oop,
  50.           AUTHOR = {Moises Lejter and Scott Meyers and Steven P. Reiss},
  51.           TITLE = {{Support for Maintaining Object-Oriented Programs}},
  52.           JOURNAL = tse,
  53.           YEAR = {1992},
  54.           VOLUME = {18},
  55.           NUMBER = {12},
  56.           MONTH = dec,
  57.           NOTE = {Also available as Brown University Computer Science
  58.                   Department Technical Report No. CS-91-52, August 1991.  An
  59.                   earlier version of this paper appeared in the
  60.                   \I{Proceedings of the 1991 Conference on Software
  61.                   Maintenance} (CSM '91), October 1991.  This paper is
  62.                   largely drawn from two other papers~\cite{sooppa,xrefdb}.}
  63.   }
  64.  
  65. Both FIELD and the Emacs interface are publicly available, but before you
  66. get too excited, let me tell you that we build prototypes here, not
  67. products, and the system we implemented is slow.  Really slow.  Really
  68. really really slow.  Honest.  Also, the database has to be rebuilt each
  69. time the source code is changed, which tends to be pretty often during
  70. development (ahem), so the current implementation is not particularly
  71. practical.
  72.  
  73. I feel compelled to point out that a fundamental problem that is overcome
  74. by neither naming conventions nor our query-based approach is that of
  75. statically determining the possible bindings of dynamically bound
  76. functions.  That is, if xxx is a virtual function, it doesn't necessarily
  77. do a lot of good to know the static type of foo, because there may be a
  78. googol of classes inheriting from foo's class, each of which redefines xxx,
  79. and there is no easy way to determine which definition is the one you're
  80. looking for.  Some minor assistance is offered by cbrowse, the FIELD class
  81. browser, which will highlight all classes that redefine a virtual function
  82. when you click on that function.  The depth of your depression then tends
  83. to be proportional to the number of things that light up on your screen :-)
  84.  
  85. I'd be interested in hearing how other environments help developers find
  86. the answer to the question the original poster raised, especially for the
  87. case where xxx is virtual.  
  88.  
  89. Having mentioned FIELD twice, and having already run on at the keyboard
  90. this long, I'll append here the standard FIELD availability blurb that I
  91. post from time to time:
  92.  
  93.   The FIELD programming environment, an extensive set of tools for
  94.   programming in C++, C, and Pascal, is available at no cost from Brown
  95.   University.  Specialized C++ tools include a class browser (cbrowse) and a
  96.   debugger that runs on top of dbx or gdb.  Both Gnu and AT&T compilers are
  97.   supported.  FIELD uses the tools of the Brown Workstation Environment
  98.   (BWE), which in turn runs on top of X11.
  99.  
  100.   If you'd like more information about FIELD, e.g., what it is, what it can
  101.   do, what systems it runs on, etc., send your questions to bwe@cs.brown.edu.
  102.   This is the address to which ALL technical correspondence should be sent.
  103.  
  104.   If you'd like to get a copy of FIELD, we have made it available via
  105.   "semi-anonymous" ftp.  Send your name, business address, phone and fax
  106.   number to brusd@cs.brown.edu and we will send you instructions on how to
  107.   get FIELD.  This address is for distribution information ONLY.
  108.   Alternatively, you may fax a request to Kathleen Kirman at 401/863-7657,
  109.   but again, this is for distribution information ONLY.  (If you don't have
  110.   FTP access, it is possible to get tape copy of the software, but there is a
  111.   charge for that form of distribution.)
  112.  
  113.   If you'd like to read about FIELD before you get it, consider these
  114.   articles:
  115.  
  116.     Steven P. Reiss, "Connecting Tools using Message Passing in the FIELD
  117.     Program Development Environment," IEEE Software, July 1990, pp. 57-67.
  118.  
  119.     Steven P. Reiss, "Interacting with the FIELD Environment," Software:
  120.     Practice and Experience, 20:S1, June 1990, pp. 89-115.
  121.  
  122.     Steven P. Reiss and Scott Meyers, "FIELD Support for C++," USENIX C++
  123.     Conference Proceedings, April 1990, pp. 293-299.
  124.  
  125.     Moises Lejter and Scott Meyers and Steven P. Reiss, "Support for
  126.     Maintaining  Object-Oriented Programs," Proceedings of the Conference on
  127.     Software Maintenance, October 1991, pp. 171-178.
  128.  
  129.   Unfortunately, electronic copies of these papers are not available.
  130.  
  131. Scott
  132.  
  133. -------------------------------------------------------------------------------
  134. What do you say to a convicted felon in Providence?  "Hello, Mr. Mayor."
  135.