home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / c / 19154 < prev    next >
Encoding:
Text File  |  1993-01-03  |  9.2 KB  |  199 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!ferkel.ucsb.edu!taco!gatech!destroyer!cs.ubc.ca!newsserver.sfu.ca!darcys
  3. From: darcys@fraser.sfu.ca (Darcy Smith)
  4. Subject: Re: Newbie Wants Advice on C-Programming
  5. Message-ID: <1993Jan3.190002.2256@sfu.ca>
  6. Sender: darcys@sfu.ca (D'Arcy Smith)
  7. Organization: Simon Fraser University, Burnaby, B.C., Canada (sortof)
  8. References: <1993Jan2.163028.8829@netcom.com> <24538@alice.att.com> <4284@dozo.and.nl>
  9. Date: Sun, 3 Jan 1993 19:00:02 GMT
  10. Lines: 187
  11.  
  12.  
  13. From newsserver.sfu.ca!cs.ubc.ca!destroyer!gatech!swrinde!zaphod.mps.ohio-state.edu!cs.utexas.edu!uunet!pipex!bnr.co.uk!uknet!mcsun!sun4nl!and!jos Sun Jan  3 09:27:40 PST 1993
  14. Article: 34226 of comp.lang.c
  15. Xref: newsserver.sfu.ca comp.lang.c++:27833 comp.lang.c:34226
  16. Path: newsserver.sfu.ca!cs.ubc.ca!destroyer!gatech!swrinde!zaphod.mps.ohio-state.edu!cs.utexas.edu!uunet!pipex!bnr.co.uk!uknet!mcsun!sun4nl!and!jos
  17. From: jos@and.nl (Jos Horsmeier)
  18. Newsgroups: comp.lang.c++,comp.lang.c
  19. Subject: Re: Newbie Wants Advice on C-Programming
  20. Message-ID: <4284@dozo.and.nl>
  21. Date: 3 Jan 93 10:14:04 GMT
  22. References: <1992Dec24.172333.7339@grebyn.com> <1993Jan2.163028.8829@netcom.com> <24538@alice.att.com>
  23. Followup-To: comp.lang.c++
  24. Organization: AND Software BV Rotterdam
  25. Lines: 57
  26.  
  27. >In article <24538@alice.att.com> bs@alice.att.com (Bjarne Stroustrup) writes:
  28. >|
  29. >|jimlynch@netcom.com (Jim Lynch @ Netcom Online Communications Services (408-241-9760 login: guest)) wrote
  30. >|
  31. >| > >You should always start out with the official books:
  32. >| > >
  33. >| > >For C, it is _The_C_Programming_Langauge_ 2nd ed. by Kernighan & Ritchie
  34. >| > >For C++, it is _The_C++_Programming_Language 2nd ed. by Stroustrup
  35. >| > 
  36. >| > No no no no no no no no no no no no. These books are _unreadible_ to a 
  37. >| > beginner.
  38. >| > However, they can be quite valuable as a reference (whenever you get 
  39. >| > around to
  40. >| > learning how to read them...)
  41. >
  42. >|It is worth remembering that `beginner' means different things in different
  43. >|contexts and what `unreadable' means depends critically on what kind of
  44. >|beginner we are talking about.
  45. >|
  46. >|If by `beginner' you mean `someone who approaches programming for the first
  47. >|time,' you are almost certainly right (though I have heard of exceptions to
  48. >|that rule). If, on the other hand, `beginner' means `experienced programmer
  49. >|who just happens never to have encountered C or C++ before,' you are with
  50. >|a high propability wrong (though again I suspect a few exceptions could be
  51. >|found).
  52. >|
  53. >|The backgrounds and expectations of want-to-be C or C++ programmers seem
  54. >|infinitely varied and textbooks, approaches to teaching, and advise must
  55. >|try to take that diversity into account. No one approach or one book can
  56. >|cover all angles.
  57. >
  58. >I think there's a bit more to leaning C++ than there is in learning C.
  59. >C++ uses quite a different paradigm: the object oriented programming
  60. >approach. Here at my company, they made me volunteer (with a gun pointed
  61. >to my head ;-) to teach the programmers team the concept of object
  62. >oriented design and programming. My first attempt was using your book
  63. >along the line of explaining inheritance, polymorphism, data encapsulation
  64. >etc. etc. We ended up discussing the misty details of the C++ language.
  65. >I completely failed here. My second attempt was, not using any programming
  66. >language at all, but just a clear explanation of the object oriented
  67. >concepts and mechanisms. When all that was clear, we switched to C++.
  68. >
  69. >This approach was much more fruitful: the C++ language became just
  70. >a mechanism to express these object oriented mechanisms. I kept on
  71. >convincing these people that it doesn't matter _how_ you express these
  72. >concepts, as long as the language offers you the building blocks to
  73. >express them. IMHO there are tree types of `beginners':
  74. >
  75. >- First time programmers;
  76. >- Experienced programmers but still unaware of the OOD concepts;
  77. >- Experienced programmers aware of OOD concepts, but they don't know
  78. >  anything about the C++ language.
  79. >
  80. >I think that one has to be a beginner of the third kind to be able
  81. >to learn the C++ language successfully.
  82. >
  83. >kind regards and happy new year,
  84. >
  85. >Jos aka jos@and.nl
  86. >
  87. I'd like to provide some exerpts from an "Interview with Bjarne Stroustrup"   
  88. found invol. 1 no.3 1991 of "The C++ JOURNAL"  - Bjarne please forgive me!
  89.  
  90.  
  91. Q) What do you recommend to people who want to learn C++ but have the idea 
  92.    of the learning curve hanging over their heads?  I don't think that this 
  93.    is the case anymore but the idea of this huge learning curve still exists.
  94.  
  95. A) ...Get a text book or two, at least two because you can never trust just 
  96.    one author.  The problem is you can't know what are the view points and 
  97.    what are the facts.
  98.  
  99.  
  100. Q) At which point should they start learning object-oriented concepts.  Is  
  101.    that something to be learned initially or something to be learned later 
  102.    on?
  103.  
  104. A) It depends.  It strongly depends.
  105.  
  106.  
  107. Q) ...when I teach...C++, I start with object-oriented concepts and then map 
  108.    them into C++ but there are others who go the other way.
  109.  
  110. A) Lets talk about this because it is tricky.  ...I invariably start with
  111.    history amd background and aims of C++.  ...I don't see how you can 
  112.    understand things, unless you understand thier background.  ...These are 
  113.    the fundamental 3 ways to use C++:
  114.       
  115.    1.  as a better C
  116.    2.  supporting data abstraction
  117.    3.  supporting object-oriented programming
  118.  
  119.    ...
  120.  
  121.  
  122. Q) Have you incorporated these ideas into you new book?
  123.  
  124. A) No, "The Annotated C++ Reference Manual" is a straight reference manual.
  125.    You should not try to learn C++ from that.  If you are more than a casual 
  126.    user, you should have it, though.  There is a statement here in the book 
  127.    states the aim: "this book provides a complete language reference for the
  128.    expert C++ user."  It is not a tutorial.  It has more about C++ than you 
  129.    ever wanted to know, because that is what a good reference manual has to 
  130.    have. ...[his first book] That book is not a manifesto for writing 
  131.    programs the way that I think you should write them. ...There are many
  132.    ways of writing programs and "the best way" depends on the application,
  133.    personality, and the background of the person writing.  there is no one 
  134.    right way.  There are so many people that write manifesto's saying, 
  135.    "Do thing my way!"  If anything, my manifesto is, "Think very hard about
  136.    rhat you are doing, then do it your way!"  I am trying to provide tools
  137.    for supporting such a view. 
  138.    ...If you have a lot of C code already and you need to do a change in
  139.    some corner of it, then it is probably very wise to start up slowly.  If 
  140.    you have to interface with a lot of C code, then the object oriented 
  141.    features are not going to fit in all that well.  So what you do is to tool
  142.    up first.  You get used to your new tools.  You use C++ as a better C, 
  143.    tighten  the type system.  You use type-safe linkage to make sure you
  144.    don't have linkage problems.  Start throwing in a little bit of data 
  145.    abstraction. We work that way in real production environments.  We have 
  146.    found that you can't take just a bunch of programmers out of their 
  147.    productive lives for, say a year and a half to teach tham to "do 
  148.    everything right."  Forget it.  We have to deliver a product within a half 
  149.    a year, a year or whatever.  Does that mean you can't go C++?  No, you can.
  150.    Can you go use C++ in a radically new style?  Not really.  So you can
  151.    throw in the "better C" and a bit of data abstraction.
  152.  
  153.  
  154. Q) At which point does the object-oriented programming and design come into
  155.    play?
  156.  
  157. A) You can not do effective OOP if you already have a framework that is
  158.    designed to prevent it. ...[the gist of this is try a new project OO
  159.    when you are ready!].
  160.  
  161.  
  162. Q) There are some people who feel if you are going to use C++, you should
  163.    use it in a completely object-oriented manner.  How would you respond to 
  164.    that?
  165.  
  166. A) What does complete object-oriented mean?  Some of the worst C++ programs
  167.    that I have seen, were written Lisp and Smalltalk styles.  C++ is not 
  168.    Smalltalk and Smalltalk is not C++.  Same with Lisp.  If you coded an 
  169.    imitation Smalltalk in C++, why would you expect it to run faster than 
  170.    Smalltalk?  You are not as smart at implementing Smalltalk's basic notions
  171.    as Peter Deutch.  Simulating something is always less conveinient and
  172.    less efficient than using the real thing.  [Bjarne, didn't you write a 
  173.    simulator a part of your Ph.D.? - just kidding] If I had wanted to to 
  174.    build an imitatin Smalltalk, I would have built a good imitation.  I was
  175.    building a good C++.  C++ is not a good Smalltalk amd Smalltalk is a
  176.    lousy C++.
  177.  
  178.  
  179. OK - sorry that this is so big - and there is much much more - however I will 
  180. stop here! - you welcome!
  181.  
  182. So my point, so nicely expressed by Bjarne, is do not use C++ in a way that it 
  183. shouldn't be used.  If your project is suited to OO ideas and you are 
  184. comfortable in useing tham - the USE them where APPROPRIATE.
  185.  
  186. You do not ever have to use a Class, inheritence, polymorphism or any other
  187. OO idea if you don't know how [but mabey you should learn!] or if it is not
  188. applicable to your program.
  189.  
  190. Fanaly here are two other C++ books:
  191.  
  192.    The C++ Programing Language - Bjarne Stroustrup
  193.    C++ Primer - Stanley B. Lippman
  194.  
  195. I'm gonna go play in the snow now [usualy it rains here] 
  196.  
  197. D'Arcy
  198.  
  199.