home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / cplus / 18230 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  3.8 KB

  1. Path: sparky!uunet!dtix!darwin.sura.net!max.fiu.edu!serss0!feathers
  2. From: feathers@serss0 (Michael Feathers)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re:  Give me safe C++
  5. Message-ID: <BzICnn.LDx@fiu.edu>
  6. Date: 19 Dec 92 13:11:46 GMT
  7. References: <1992Dec6.131757.7448@ucc.su.OZ.AU> <716@ulogic.UUCP> <1992Dec18.134937.14313@bony1.bony.com>
  8. Sender: news@fiu.edu (Usenet Administrator)
  9. Organization: Florida International University, Miami
  10. Lines: 69
  11.  
  12. In article <1992Dec18.134937.14313@bony1.bony.com> richieb@bony1.bony.com (Richard Bielak) writes:
  13. >In article <716@ulogic.UUCP> hartman@ulogic.UUCP (Richard M. Hartman) writes:
  14. >
  15. >[...]
  16. >
  17. >>Safety (when not being enforced by the language) is to a large
  18. >>extent (IMHO) a matter of good programming practices.  Like a
  19. >>seemingly ever-growing segment of the general populace, the cry
  20. >>comes "oh powers that be, protect us from ourselves", and thus
  21. >>we get laws requiring people to wear seatbelts.  It is no that
  22. >>I am against seatbelts (or safety), but I was perfectly capable
  23. >>of wearing a seatbelt before the law existed.  To my mind, there
  24. >>was no *need* for the law.  
  25. >
  26. >This analogy with seat belts bugs me. Here is why. Seatbelts are there
  27. >for the benefit of consumer of cars.
  28. >
  29. >This implies that programmers are *consumers* of programming
  30. >languages. This misses the point, that programmers are the
  31. >*manufacturers* of software.
  32. >
  33. >Don't you agree, that safety regulations forced on the manufacturer
  34. >are a good thing? Rememeber the Ford Pinto?
  35.  
  36. I don't.  The bad press that Ford got because of the Pinto out stripped any
  37. incentive towards safety that a regulation could generate.  Believe it or not,
  38. safety is a side effect in a free market.
  39.  
  40. >If you are writing safety critical software - let's say software that
  41. >controls the brakes in *my* car - I'd rather have you code in PASCAL
  42. >and run with all the runtime checks on. I don't want my brakes to stop
  43. >working just because you forgot an ampersand.
  44.  
  45. I wouldn't rather have the code written in Pascal.  The reason has to do with
  46. one of my experiences as an undergraduate.  
  47.  
  48. Before I started majoring in computer science, I took it upon myself to teach
  49. myself C as a first language.  Everyone I knew at the time said that C was
  50. a hard language to learn and I figured that if I was capable of doing that I 
  51. probably wouldn't get half way through my degree and then discover that I was
  52. not cut out for programming.
  53.  
  54. Well, I spent a good amount of time writing over the edges of arrays and
  55. dereferencing null pointers before I finally figured out that I should really
  56. understand my code before it executes and construct it in such a way that I
  57. know when a run time check is or is not necessary.  I learned this lesson
  58. thoroughly only after getting extremely tired of crashing in C.
  59.  
  60. In my last year as an undergraduate, I remember looking over my shoulder in the
  61. labs at the terminal of my neighbor.  He had a run-time bounds error message
  62. on his screen.  At that point I had been doing Pascal projects for a few years
  63. at school and I had never seen one of those before.  Checking around, I 
  64. discovered that they were not too uncommon.  My conclusion was that run time
  65. checking was being used as a crutch.
  66.  
  67. If I had it my way, I'd have C taught as a first programming language in CS
  68. curricula.  If nothing else it would teach students that the best safety
  69. measure they can take with their code is to understand it.  The iterative
  70. cycle of getting run time errors, patching them and then getting more run time
  71. errors should never have to occur and should never be relied upon my 
  72. beginning students.
  73.  
  74. I've seen students who learn C first have no problem wih Pascal other than
  75. claustrophobia, and I've seen students who learn Pascal first have an 
  76. extremely agonizingly difficult time learning C because it does not have their
  77. familiar crutches.
  78.  
  79.  
  80. Michael Feathers     feathers@fiu.edu
  81.