Article View: comp.os.msdos.programmer
Article #6227Re: Newbie Wants Advice on C-Programming
From: Michael Malak
Date: Wed, 30 Dec 1992 05:51
Date: Wed, 30 Dec 1992 05:51
69 lines
3785 bytes
3785 bytes
In article <24506@alice.att.com> bs@alice.att.com (Bjarne Stroustrup) writes: > >Consider a few common questions: > > I don't know C or C++, should I learn C first? > >No. Learn C++ first. The C subset of C++ is easier to learn for C/C++ >novices and easier to use than C itself. The reason is that >C++ provides better guarantees than C (stronger type checking). >In addition, C++ provides many minor features, such as the `new' >operator, that are notationally more convenient and less error-prone >than their C alternatives. Thus, if you plan to learn C and C++ (or >just C++) you shouldn't take the detour through C. To use C well, >you need to know tricks and techniques that aren't anywhere near >as important or common in C++ as they are in C. Good C textbooks >tends (reasonably enough) to emphasize the techniques that you >will need for completing major projects in C. Good C++ textbooks, >on the other hand, emphasizes techniques and features that lead >to the use of C++ for data abstraction and object-oriented programming. >Knowing the C++ constructs, their (lower-level) C alternatives are >trivially learned (if necessary). > >To show my inclinations: > > To learn C use: > > Kernighan and Ritchie: > The C programming Language (2nd edition) > Prentice Hall, 1988. > > as the primary textbook. To learn C++ use > > Stroustrup: > The C++ programming Language (2nd edition) > Addison Wesley, 1991. > >Both books have the advantage of combining a tutorial presentation >of language features and techniques with a complete reference manual. >Both describes their respective languages rather than particular >implementations and neither attempts to describe particular libraries >shipped with particular implementations. > >There are many other good textbooks and many other styles of >presentation, but these are my favorites for comprehension >of concepts and styles. It is always wise to look carefully >at at least two sources of information to compensate for bias >and possible shortcommings. This is where I respectfully disagree with you. While programmers undoubtedly do well under your personal tutelage, my experience has been that FORTRAN programmers who teach themselves C commit the cardinal sins against good programming practice that I listed in a previous post. In my opinion, structured programming, style, and good habits must be taught by a teacher. And since most structured programming teachers prefer Pascal, I recommended taking a college structured programming Pascal course. Your points about the superior subset of C in C++ are good, but I don't see anywhere in your book where you caution novices against jumping into class creation right away and just learning the traditional features. Again, one could benefit from having a teacher such as yourself, but the one who is trying to teach himself does not have such guidance and could quickly get mired in the advanced features of C++. I recommended self-teaching C before C++ because the trick to C++ is when _not_ to create a class, and I've found this mentioned only in articles and never in any textbooks. I think the suggestion of a FORTRAN programer jumping into C on his own is a very bad one, and the idea of him getting into C++ is ludicrous.
Technical Details
Message-ID:
<1992Dec30.055154.22465@grebyn.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!grebyn!daily!malakReferences:
<1992Dec25.073517.16089@grebyn.com> <1992Dec29.003005.27059@ucc.su.OZ.AU> <24506@alice.att.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer,comp.sys.ibm.pc.programmer,comp.lang.c++,comp.lang.c Path: arc1-ca.pugleaf.net!sparky!uunet!grebyn!daily!malak From: malak@grebyn.com (Michael Malak) Subject: Re: Newbie Wants Advice on C-Programming Message-ID: <1992Dec30.055154.22465@grebyn.com> Organization: Grebyn Timesharing References: <1992Dec25.073517.16089@grebyn.com> <1992Dec29.003005.27059@ucc.su.OZ.AU> <24506@alice.att.com> Date: Wed, 30 Dec 1992 05:51:54 GMT Lines: 70