home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / msdos / programm / 11695 < prev    next >
Encoding:
Internet Message Format  |  1992-12-27  |  3.7 KB

  1. Xref: sparky comp.os.msdos.programmer:11695 comp.sys.ibm.pc.programmer:703 comp.lang.c++:18532 comp.lang.c:19008
  2. Newsgroups: comp.os.msdos.programmer,comp.sys.ibm.pc.programmer,comp.lang.c++,comp.lang.c
  3. Path: sparky!uunet!grebyn!daily!malak
  4. From: malak@grebyn.com (Michael Malak)
  5. Subject: Re: Newbie Wants Advice on C-Programming
  6. Message-ID: <1992Dec30.055154.22465@grebyn.com>
  7. Organization: Grebyn Timesharing
  8. References: <1992Dec25.073517.16089@grebyn.com> <1992Dec29.003005.27059@ucc.su.OZ.AU> <24506@alice.att.com>
  9. Date: Wed, 30 Dec 1992 05:51:54 GMT
  10. Lines: 70
  11.  
  12. In article <24506@alice.att.com> bs@alice.att.com (Bjarne Stroustrup) writes:
  13. >
  14. >Consider a few common questions:
  15. >
  16. >    I don't know C or C++, should I learn C first?
  17. >
  18. >No. Learn C++ first. The C subset of C++ is easier to learn for C/C++
  19. >novices and easier to use than C itself. The reason is that
  20. >C++ provides better guarantees than C (stronger type checking).
  21. >In addition, C++ provides many minor features, such as the `new'
  22. >operator, that are notationally more convenient and less error-prone
  23. >than their C alternatives. Thus, if you plan to learn C and C++ (or
  24. >just C++) you shouldn't take the detour through C. To use C well,
  25. >you need to know tricks and techniques that aren't anywhere near
  26. >as important or common in C++ as they are in C. Good C textbooks
  27. >tends (reasonably enough) to emphasize the techniques that you
  28. >will need for completing major projects in C. Good C++ textbooks,
  29. >on the other hand, emphasizes techniques and features that lead
  30. >to the use of C++ for data abstraction and object-oriented programming.
  31. >Knowing the C++ constructs, their (lower-level) C alternatives are
  32. >trivially learned (if necessary).
  33. >
  34. >To show my inclinations:
  35. >
  36. >    To learn C use:
  37. >
  38. >        Kernighan and Ritchie:
  39. >        The C programming Language (2nd edition)
  40. >        Prentice Hall, 1988.
  41. >
  42. >    as the primary textbook. To learn C++ use
  43. >
  44. >        Stroustrup:
  45. >        The C++ programming Language (2nd edition)
  46. >        Addison Wesley, 1991.
  47. >
  48. >Both books have the advantage of combining a tutorial presentation
  49. >of language features and techniques with a complete reference manual.
  50. >Both describes their respective languages rather than particular
  51. >implementations and neither attempts to describe particular libraries
  52. >shipped with particular implementations.
  53. >
  54. >There are many other good textbooks and many other styles of
  55. >presentation, but these are my favorites for comprehension
  56. >of concepts and styles. It is always wise to look carefully
  57. >at at least two sources of information to compensate for bias
  58. >and possible shortcommings.
  59.  
  60. This is where I respectfully disagree with you.  While programmers
  61. undoubtedly do well under your personal tutelage, my experience has been
  62. that FORTRAN programmers who teach themselves C commit the cardinal sins
  63. against good programming practice that I listed in a previous post.  In
  64. my opinion, structured programming, style, and good habits must be
  65. taught by a teacher.  And since most structured programming teachers
  66. prefer Pascal, I recommended taking a college structured programming
  67. Pascal course.
  68.  
  69. Your points about the superior subset of C in C++ are good, but I don't
  70. see anywhere in your book where you caution novices against jumping into
  71. class creation right away and just learning the traditional features.
  72. Again, one could benefit from having a teacher such as yourself, but the
  73. one who is trying to teach himself does not have such guidance and could
  74. quickly get mired in the advanced features of C++.  I recommended
  75. self-teaching C before C++ because the trick to C++ is when _not_ to
  76. create a class, and I've found this mentioned only in articles and never
  77. in any textbooks.
  78.  
  79. I think the suggestion of a FORTRAN programer jumping into C on his own
  80. is a very bad one, and the idea of him getting into C++ is ludicrous. 
  81.  
  82.