[comp.lang.c++] Recommended book for C programmer learning C++

andrew@teslab.lab.OZ (Andrew Phillips) (11/07/90)

I am a new reader of this group so I apologize if this has been asked
before recently.  I need a book to learn C++ for an experienced C
programmer.  I read Stroustrup three or four years ago and got little
out of it.  I have seen the following in a book shop:

ARM                             Ellis and Stroustrup
C++ Techniques and Applications Scott Robert Ladd
Using C++                       Bruce Eckel
Waite Group's C++ Programming   John Berry

On browsing through these, I thought that Eckel looked to be most
suitable.  I didn't even look at Berry as I bought an atrocious book
of his before on programming the Amiga in C.

Thanks in advance for any help.

Andrew.
-- 
Andrew Phillips (andrew@teslab.lab.oz.au) Phone +61 (Aust) 2 (Sydney) 289 8712

jbuck@galileo.berkeley.edu (Joe Buck) (11/13/90)

In article <1148@teslab.lab.OZ>, andrew@teslab.lab.OZ (Andrew Phillips) writes:
> I am a new reader of this group so I apologize if this has been asked
> before recently.  I need a book to learn C++ for an experienced C
> programmer.  I read Stroustrup three or four years ago and got little
> out of it.  I have seen the following in a book shop:

> ARM                             Ellis and Stroustrup

Ellis and Stroustrup's "The Annotated C++ Reference Manual" is the de facto
language standard.  However, it's not intended to teach the language and is
definitely not for beginners.

> C++ Techniques and Applications Scott Robert Ladd

I am not familiar with this book.

> Using C++                       Bruce Eckel

This is OK, but most of the book describes programming under C++ version
1.2 and C++ version 2.0 is covered in an appendix.  This book was good
in its time, but unless you have an old compiler I wouldn't recommend it.

> Waite Group's C++ Programming   John Berry

This book is absolute crap and should not be foisted off on anyone.
The Waite Group should be thoroughly ashamed, as should John Berry.

> On browsing through these, I thought that Eckel looked to be most
> suitable.  I didn't even look at Berry as I bought an atrocious book
> of his before on programming the Amiga in C.

So Berry has a track record, does he?  It seems he's done it again.

I recommend Lippman's "C++ Primer" as the best book for learning the
language that I have seen.  Lippman is a member of Stroustrup's research
group, and the book is well-written and accurate.


--
Joe Buck
jbuck@galileo.berkeley.edu	 {uunet,ucbvax}!galileo.berkeley.edu!jbuck	

jamiller@hpcupt1.cup.hp.com (Jim Miller) (11/13/90)

Most Frequently Asked Question??????

From what I've seen and heard...

   1) The C++ Primer by Lippman
      and
   2) Programming in C++ by Dewhurst & Stark

Seem to be the best two for learning the language.
Lippman's better if you don't already know C.

Learning to use OOA/OOD/OOL is a different matter and I haven't heard of
any real clear winners.

   jim miller
   jamiller@hpmpeb7.cup.hp.com
   (a.k.a James A. Miller; Jim the JAM; stupid; @!?$$!; ... )
   Anything I say will be used against me ...
   But my company doesn't know or approve or condone anything of mine here.

andrew@teslab.lab.OZ (Andrew Phillips) (11/15/90)

In article <1148@teslab.lab.OZ> I wrote:
> I need a book to learn C++ for an experienced C programmer.

Thanks to all those who replied to my posting!  By far, the
overwhelming response was to get C++ Primer by Lippman.  Ellis and
Stroustrup's ARM (Annotated Reference Manual) was also recommended
by many for the more knowledgeable C++ programmer.
-- 
Andrew Phillips (andrew@teslab.lab.oz.au) Phone +61 (Aust) 2 (Sydney) 289 8712

lanning@parc.xerox.com (Stan Lanning) (11/17/90)

I found Lippman's book to be, well, less then acceptable.  It may help
you learn the language, but it fails when it comes to illustrating
programming.

As the author says in the preface, "...the book is organized around a
series of extended examples."  While the examples may serve the
immediate goal of illustrating a particular topic, they often show a
concern for micro-optimization and a disregard for other issues.
Experienced programmers will find these examples disturbing; novice
programmers could come away with a misunderstanding of the art of
programming.

I would hope that a book would use examples of _good programming_ that
illustrate the desired aspects of the language.  This book doesn't
satisfy that desire.

Here are some examples:

-----
Section 2.13, page 87.

This section uses as an example "a member function to return the minimum
value contained in an IntArray class object."  The function works by
walking through the array, storing the minimum value found so far in the
variable minVal.  He raises the question: what should the initial value
of this variable be?  He states "One approach is to initialize minVal
with the largest possible integer value... this will work in every case.
It is not, however, the best strategy."  He then digresses into an
analysis of different possible cases, and concludes "In *all* cases, by
making minVal's initial value the first element of the array, we are
guaranteed to save one assignment.  In addition, only n-1 elements need
to be examined."  He does not mention that this method is easier to
understand, or that there might be some difficulty in computing the
largest possible integer value, or that this approach is applicable in
situations where there is no largest possible value.  The only reason
given is the saving of a single assignment.

-----
Section 3.2, page 107.

Discussing inline functions, the author states:

 A question not as yet addressed directly is why min() was defined as a
 function.  To reduce the amount of code duplication is not the reason.
 It actually requires one more character to write

	min(i, j);

 then to write the function directly:

	i < j ? i : j;

He then goes on to mention five reasons why using min() is a good idea.
He does not mention that open-coding requires computing an argument
twice.  Apparently this is not as important as a discussion of the
number of characters required to type the expression.

-----
Section 4.2, page 149.

This page contains the following implementation of the function concat()
that can be used to concatenate two linked lists of integers:

 void IntList::concat( IntList& il )
 { // append il.list to invoking list object
     IntItem *pt = il.list;
     while ( pt ) {
         append( pt->val );
         pt = pt->next;
     }
 }

How is append() defined?  From page 144:

 IntList::append( int val )
 {// add to the back of the list
   IntItem *pt = new IntItem( val );
   if ( list == 0 )
      list = pt;
   else
      (atEnd())->next = pt;
   return val;
 }

How is atEnd() defined?  It walks down the list, and returns the last
IntItem in the list.  This is order N in the length of the list. It gets
called once for each call to append(), which is called once for each
element of the second argument to concat().  Thus, this implementation
of concat() is order N^2.

-----
--

-- smL

mjv@objects.mv.com (Michael J. Vilot) (11/22/90)

Jim Miller noted:
> Learning to use OOA/OOD/OOL is a different matter and I haven't heard of
> any real clear winners.

I can recommend one book on these topics:
  Object Oriented Design with Applications
  Grady Booch
  Benjamin/Cummings
  ISBN 0-8053-0091-0

I find it valuable for the Bibliography alone.  The book has 3 sections: 
Concepts, Method, and Examples.  Many folks I talk to have found the Concepts
section very helpful.  The method section presents a method that has evolved
over the last 10 years through application on actual software projects.  Some
consider it less rigorous than they would like, but I find it useful and more
comprehensive than other OOD methods.  The examples are fun, because each one
is implemented in a different language: Smalltalk, Object Pascal, C++, CLOS, and
Ada.  I find it entertaining to try to understand the details of the examples in
the languages I'm not fluent in.

--
Mike Vilot,  ObjectWare Inc, Nashua NH
mjv@objects.mv.com  (UUCP:  ...!decvax!zinn!objects!mjv)

perf@efd.lth.se (Per Foreby) (11/24/90)

In article <LANNING.90Nov16154228@archer.parc.xerox.com> lanning@parc.xerox.com (Stan Lanning) writes:

> I found Lippman's book to be, well, less then acceptable.  It may help
> you learn the language, but it fails when it comes to illustrating
> programming.
> 

I like Stroustrup's book, but would need something that covers C++ 2.0.

  1. Is there a new Stroustrup book available?

  2. Any other book which covers the whole language (probably
     including a reference manual)?

Please email.
--
Per Foreby					Email: perf@efd.lth.se
System manager at EFD, Lund Institute of Technology (Lund University)
Snail: E-huset, LTH, Box 118, S-221 00 LUND, Sweden. Phone: +46 46 107492