home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / programm / 2393 < prev    next >
Encoding:
Internet Message Format  |  1992-08-19  |  2.5 KB

  1. Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!ames!agate!linus!linus.mitre.org!church.mitre.org!crawford
  2. From: crawford@church.mitre.org (Randy Crawford)
  3. Newsgroups: comp.programming
  4. Subject: Re: Teaching by Value (was Re: Teaching the Basics)
  5. Message-ID: <1992Aug20.044100.15875@linus.mitre.org>
  6. Date: 20 Aug 92 04:41:00 GMT
  7. References: <1992Aug18.230426.26425@lucid.com> <1992Aug19.135744.14889@husc13.harvard.edu> <1992Aug19.142513.14893@husc13.harvard.edu>
  8. Sender: news@linus.mitre.org (News Service)
  9. Organization: The MITRE Corporation, McLean, VA
  10. Lines: 37
  11. Nntp-Posting-Host: church.mitre.org
  12.  
  13. In article <1992Aug19.142513.14893@husc13.harvard.edu> peregrin@husc13.harvard.edu writes:
  14. ...
  15. >    Should efficiency really be a concern at the introductory
  16. >level? Should that concern be reduced so that more time can be spent on
  17. >problem solving?
  18. >
  19. >    If you look at your programming peers, are you more concerned that
  20. >they can write easily maintainable code than if they can write super-slick
  21. >fast routines?  Who do you want on your programming team?  Should the
  22. >majority of programmers be writers of clean, easy to read and maintain
  23. >code, and only a few are needed to right tight, fast, efficient routines?
  24.  
  25. In the words of Samuel Johnson (as paraphrased by Charniak, McDermott, Riesbeck,
  26. and Meehan) "we advise you to look over your code very carefully, and whenever
  27. you find a part that you think is particularly fine, strike it out."
  28.  
  29. I think efficiency is always a concern.  However, there is efficient code and 
  30. there is clever code.  Efficient is good; clever (usually) is not.  I see
  31. the difference as:  efficient code is marked by a lack of waste; clever code is 
  32. a weird trick which is unnaturally efficient.  Weird code is interesting and 
  33. fast, but is generally illegible, unmaintainable, and unextensible.  Excessively
  34. efficient code is almost never worth its other excesses.
  35.  
  36. The only time that cleverness may be preferable is in routines which will be 
  37. reused extensively, as in libraries, or in computationally intensive algorithms
  38. where efficiency is everything.  
  39.  
  40. So in answer to your last question:  Yes.  Very few programmers need to be 
  41. "clever".  The rest of us should focus on writing efficient readable code.
  42.  
  43. Randy
  44. crawford@mitre.org
  45. -- 
  46.  
  47. | Randy Crawford        crawford@mitre.org        The MITRE Corporation
  48. |                                                 7925 Colshire Dr., MS Z421
  49. | N=1 -> P=NP           703 883-7940              McLean, VA  22102
  50.