From: jimlynch@netcom.com (Jim Lynch)
Newsgroups: alt.msdos.programmer,comp.os.msdos.programmer,comp.sys.ibm.pc.programmer,comp.lang.c++,comp.lang.c
Subject: Re: Newbie Wants Advice on C-Programming
Date: 2 Jan 93 16:30:28 GMT
Organization: Netcom Online Communications Services (408-241-9760 login: guest)

In article <1992Dec24.172333.7339@grebyn.com> malak@grebyn.com (Michael Malak) writes:
>In article <1992Dec23.220530.15347@netcom.com> noring@netcom.com (Jon Noring) writes:
>>1) There seems to exist C, as well as C++, and possibly other variants.  What
>>   are the differences between these?  Which should we learn first?
>
>In my opinion, there is no fast track to either C or C++.  

This is absolutely true. Both languages are littered with 'features' that make
the language efficient by sacrificing some what-you-tell-it-is-what-it-does
kind of functionality.

>I feel the
>following must be learned in order:
>   1) Pascal, with two semesters experience

Again, we agree.

>   2) Assembly, learned anywhere, with tinkering on your own

Yes but there are other ways to gain the necessary experience in machine-level
issues and details. One way is to jump right into C (recommend a course in this
case), another way might be to bridge the gap with a stack-based interpretive
language such as Forth or Stoic (or PostScript??? hehe) because you will
_always_ be running into the stack, and certain old-compiler/absence of
function prototypes kinds of problems require for their understanding an
understanding of stacks (with extensive practice in using stacks).

>   3) C, 2-3 years min. anywhere (college, real world, or tinkering)

Absolutely. C is a proper subset of C++, so learn C as thoroughly as possible.

>After that you can learn and appreciate C++.  You need to first learn
>structured programming and algorithms, most importantly, linked lists
>and trees.  

Absolutely. After writing Mac Applications in C, I went back and took an intro
and a data structures/algorithms course and it filled in MANY holes.

[discussion of C's close ties with assembly deleted]

>To summarize, C programs should appear structured like Pascal programs,

(this is why I think it's important to learn Pascal. Besides, it was designed
for the express purpose of teaching structured programming and its concepts.)

>but are really shorthand for assembly programs.  C++ facilitates
>object-oriented programming, but you need experience when to use it
>because you can too easily introduce inefficiencies.

due to the fact that C lifts Pascal's protection of the programmer from him/her-
self.

>>4) What books would you recommend in learning C (my wife might want to take
>>   classes - I do better teaching myself)?  And of course, since I will be
>>   doing programming on a PC, what books would you recommend that are
>>   specific to that platform, especially w.r.t. memory management as well
>>   as graphics?
>
>You should always start out with the official books:
>
>For C, it is _The_C_Programming_Langauge_ 2nd ed. by Kernighan & Ritchie
>For C++, it is _The_C++_Programming_Language 2nd ed. by Stroustrup

No no no no no no no no no no no no. These books are _unreadible_ to a beginner.
However, they can be quite valuable as a reference (whenever you get around to
learning how to read them...)

>For each language, you may optionally buy a more tutorial or descriptive
>book.  

If you expect to learn C/C++ in any resemblence of a pleasant experience,
this is *NOT* optional.

>The books listed above are more reference books than tutorials.
>Although they do start with the basis, and then build on them, they do
>so in a math book kind of way.  Just go to a computer book store and
>thumb through some of the books and buy the one(s) that appear to teach
>the way you like to learn.  

This is arguably the best comment you have made. I agree completely.

>Use the reference books to verify the
>tutorial books, and to provide complete information.

Great suggestion for experienced C programmers as well as beginners who have
majored in math. My feeling is that as humans have limited time, they must
choose some things and ignore others, just like you have to do in the vast
world of the internet. Verification takes a long time. Understanding those
practically-unreadible-but otherwise-great reference texts also takes a long
time. Learning to program in C takes a long time too but not _as_ long.

>As for memory management, it is a non-issue in the 32-bit world, which
>is the way the world is going.  The kluges invented for the 16-bit
>DOS world, expanded memory (EMS) and extended memory (XMS) are pretty
>technical and not necessary for either 16-bit Windows or 32-bit DOS
>extenders.

Memory management is never a non-issue unless you own the computer and there
are no OSes or anything else in the memory space of _your_ (otherwise
completely empty) computer.

A partial response to this question should include the fact that functions
which allocate and free memory are available in the standard library of C
and C++. Otherwise, this is a subject to be taken up in the process of learning
the language.

All in all, your comments have been thoughtfull and correct, however some of
the comments will only be appropriate sometime between 6 months and 3-4 years
from now when the original questioner is much more experienced. You've forgotten
what it was like to be a beginner.
Newsgroups: alt.msdos.programmer,comp.os.vms,comp.os.msdos.apps