home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / software / 5056 < prev    next >
Encoding:
Internet Message Format  |  1992-12-20  |  2.7 KB

  1. Path: sparky!uunet!spool.mu.edu!sol.ctr.columbia.edu!eff!news.oc.com!utacfd.uta.edu!rwsys!lerami!dalsil!titus
  2. From: titus@dallas.sil.org
  3. Newsgroups: comp.software-eng
  4. Subject: Re: C code layout
  5. Message-ID: <1992Dec17.115835.71@dallas.sil.org>
  6. Date: 17 Dec 92 11:58:35 CST
  7. Organization: Summer Institute of Linguistics, Dallas Center
  8. Lines: 55
  9.  
  10. daves@hpopd.pwd.hp.com (Dave Straker) writes
  11.  
  12. >On balance, I'd probably do a bit of both. I'd also get students
  13. >to mark one another's work for both, thus saving a bit of lecturer's
  14. >effort whilst simultaneously letting them find out the value of
  15. >using a style with which other people are familiar.
  16.  
  17.     I think Dave is on to something with requiring students 
  18. to go over each other's work.
  19.     I have personally done A LOT more maintenance work than 
  20. new development, so I think I can safely speak for the poor 
  21. maintenance hack who has to come in (sometimes MUCH!!) later 
  22. and try to figure out what is going on.  I have also 
  23. occasionally had to go back to my own code long after 
  24. forgetting why I did something that looks dumb at first 
  25. glance.  As a result, some of my code may contain several 
  26. lines of comments to explain a short code fragment.
  27.  
  28. For example:
  29.  
  30.   /* RT-11 normally caches the directory of the last device read.     */
  31.    /*  If another tape, disk, or whatever is inserted in that drive,  */
  32.    /*  it still assumes it has the correct directory.  To get around  */
  33.    /*  this, we do a dummy open on SY:, since we assume that most     */
  34.    /*  input files will be on DK:.  That way, when we attempt to open */
  35.    /*  a file on DK:, it doesn't have the directory in memory and     */
  36.    /*  will actually read the directory.  Otherwise, we may get a     */
  37.    /*  "File not found" when the file is actually there.              */
  38.  
  39.       fopen("SY:Z.X", "r");
  40.  
  41.     My own experience (first 2-3 years professionally 
  42. writing device drivers in assembler) taught me the absolute 
  43. NECESSITY of putting good comments in the code, especially 
  44. re: register usage.  I later did a maintenance job on a 
  45. 15,000+ line C program which had previously been worked on 
  46. by an ex FORTRAN jockey.  Talk about terse, non-intuitive 
  47. variable names!
  48.     I now tend to, even when sketching out an algorithm on 
  49. paper for someone, add comments as a matter of course.
  50.  
  51.  
  52.                * * * * * * * * * * * * * * * * *
  53. Mike Titus, Programmer                  /\   Summer Institute
  54. SIL                                    /  \        of
  55. 7500 West Camp Wisdom Road            /SIL \   Linguistics
  56. Dallas, Texas  75236-5699            --------
  57. U.S.A.
  58. Voice    : (214) 709-2400        * Internet <titus@dallas.sil.org>
  59. Facsimile: (214) 709-3387        * UUCP     ...utafil!txsil!dalsil!titus
  60.  
  61. "I can do everything through Him who gives me strength."
  62.  
  63.                         Philippians 4:13 (NIV)
  64.  
  65.