[comp.lang.c++] Readable C++ book

bob@imsvax.UUCP (Bob Burch) (03/23/88)

Could anybody suggest a readable book (as opposed to Stroustrup's book)
on the subject of C++?  Any help would be appreciated.

Ted Holden
HTE

reggie@pdn.UUCP (George W. Leach) (03/24/88)

In article <804@imsvax.UUCP> bob@imsvax.UUCP (Bob Burch) writes:
>
>Could anybody suggest a readable book (as opposed to Stroustrup's book)
>on the subject of C++?  Any help would be appreciated.


    What is the problem?  Can't you read English :-)


    But seriously, here is an alternative that should be available shortly
(or so Addison-Wesley keeps telling me :-):


           An Introduction to Object-Oriented Programming and C++
           Richard Wiener and Lewis Pinson, U of Colorado, 
           Addison-Wesley


     Although, I have not seen this book the description that Addison-Wesley
handed out at OOPSLA'87 this past fall indicated that it may be more appropriate
than Bjarne's book for an introductory level programmer.


     For more information on this book, call Addison-Wesley at (617) 944-3700



-- 
George W. Leach					Paradyne Corporation
{gatech,rutgers,attmail}!codas!pdn!reggie	Mail stop LF-207
Phone: (813) 530-2376				P.O. Box 2826
						Largo, FL  34649-2826

rcm@tropix.UUCP (Robert C. Moore) (03/29/88)

In article <804@imsvax.UUCP> bob@imsvax.UUCP (Bob Burch) writes:
>
>Could anybody suggest a readable book (as opposed to Stroustrup's book)
>on the subject of C++?  Any help would be appreciated.
>
>Ted Holden
>HTE

Two very readable books come immediately to mind:

Object Oriented Programming, An Evolutionary Approach
	by Brad Cox, Productivity Products Int'l
	Addison Wesley, 1987 ISBN 0-201-10393-1

	On object oriented programming in general, and C++, 
Smalltalk, and Objective C (his company's product) are used
extensively.  Very clear and well motivated.  Heavily emphasizes
reusability of code and "Software IC's".  I especially enjoy
his perspective on Structured Design and the Maginot Line,
(build a huge defence against change and maybe you can delay the
inevitable a bit) compared with object oriented programming
and the Swiss Defense (prepare for change and control the extent
of the effect of change on the total project).
See Cox's article in IEEE Software, Jan 84, pg 50-60 and BYTE
Aug 86, pg 161-176.

An Introduction to Object Oriented Programming and C++
	by R S Wiener and L J Pinson, U of Colorado, Colo. Springs
	Addison Wesley, 1988 ISBN 0-201-15413-7

	Builds on C and, again, very easy to read.  Just
got my copy today (it went to press last week), so you'll
need to go directly to the publisher for a copy.


C++ for the IBM PC
	by John Berry, Foothills College, Cal
	Howard Sams, ms form

	Will be even simpler, presenting C++ to the masses.  I
havn't seen a copy yet.

John Carolan (Glockehshpiel Ltd., Belfast Ire) is also writing a
top notch book on C++.  Again, I havn't seen a copy.




					Bob Moore
					Tropel
					ihnp4!tropix!rcm

jima@hplsla.HP.COM ( Jim Adcock) (03/29/88)

|    But seriously, here is an alternative that should be available shortly
|(or so Addison-Wesley keeps telling me :-):
|
|
|           An Introduction to Object-Oriented Programming and C++

Today (Mar28) I called Addison-Wesley, and they claimed the book is available
now and accepted my order for it -- $27.95

I'll report back on the book after I actually receive it. [Until then,
Caveat Emptor :-)]

jima@hplsla.HP.COM ( Jim Adcock) (04/08/88)

| |    But seriously, here is an alternative that should be available shortly
| |(or so Addison-Wesley keeps telling me :-):
| |
| |
| |           An Introduction to Object-Oriented Programming and C++
| 
| Today (Mar28) I called Addison-Wesley, and they claimed the book is available
| now and accepted my [credit card] order for it -- $27.95 [+ taxes + postage]
| 
| I'll report back on the book after I actually receive it. [Until then,
| Caveat Emptor :-)]

I just received the above book, which took about 1.5 weeks to arrive [by mail] 
after my order, and did a quick initial scan of it last night.

So with the caveat that what follows are my, [and mine only,]
very initial impressions:

+ Overall, I think this is book worth having, if only because the Stroustrup is
  the only other C++ book available.

+ This book assumes the reader has K&R as a background and spends very little 
  time going over features K&R C and C++ have in common.

+ This should be a good book for the reader with extensive background in C,
  but with little or no background in C++ nor "object oriented programming."

+ The book spends a fair amount of its time on some medium complexity program
  examples, which I feel represent about a medium quality programming effort.

+ The book does spend most of its time addressing the "object oriented" aspects
  of C++.

+ The author appears to take an approach influenced somewhat by Modula 
  [there are some comparisons to Modula in the text].  Fortunately, this
  author does not take an approach where he tries to re-implement Smalltalk
  in C++.

- The few illustrations are not "worth a thousand words", maybe twelve words.

- The book follows the unfortunate trend of many computer language books of 
  printing the program listings in an ugly and difficult to read font --
  in order to distinguish the program listings from the body of the text.

+ This author uses the style of balanced braces rather than dangling braces. 

+ This author DOES NOT make use of non-syntactic #defines.

- The book doesn't contain info on the latest 2.0 goodies.  I'd guess the book
  corresponds to about AT&T version 1.2.

- This book follows the historical assumption that the AT&T "translator" IS C++.
  That is to say, it didn't anticipate that C++ compilers are becoming
  available from independent sources.  This doesn't affect the meat of the book,
  which doesn't seem to spend any significant amount of time covering what it 
  takes to compile C++ on any given machine, but is a problem that only shows up
  in some of the book's ancillary comments.

+ The book seems to contain enough detail to probably get the average C user up 
  and running, writing casual C++ programs in an "object oriented" style.

- The book probably does not get into enough details of the hairy issues with
  C++ and object oriented approaches in general to satisfy the needs of 
  professional programmers attempting to write large commercial products in C++.
  Issues like garbage collection and memory management, storing and restoring
  objects to disc, error recovery, exceptions, multiple inheritence, efficiency
  details, etc .....
 
- This book does not have any examples related to graphical windowing systems.
  Given that standards are just emerging in this area, I guess I shouldn't be
  surprised.  But I feel that a majority of "object oriented" programming
  efforts ARE going to be directed at graphical windowing systems, such as 
  X Windows.  So its hard for me to see how you can seriously write about
  "object oriented" programming without addressing graphical windowing systems.

+ This book does not appear to contain the flagrant typos, typesetting
  errors, obvious inaccuracies, etc. that are found in some low quality computer
  texts I'm sure we've all run across.

Finally, I must re-emphasize that these are my opinions alone and represent
only a half dozen hours worth of scanning and reading the book.

jima@hplsla.HP.COM ( Jim Adcock) (04/11/88)

|| An Introduction to Object-Oriented Programming and C++

I also saw this book at some of Seattle's better books stores on 
4/10/88, so you may want to look for it [and look over it]
locally rather than mail-ordering it.

alex@cca.CCA.COM (Alexis Layton) (04/12/88)

Well, I don't know what book you were reading, but I found

	_An Introduction to Object-Oriented Programming and C++_
	(Richard S. Wiener & Lewis J. Pinson.  Addison-Wesley.
	ISBN 0-201-15413-7.)

very disappointing.  The authors appear to have experience with object-oriented
programming languages, but their hands-on knowledge of C++ is suspect.  I found
the book full of annoying little errors.  Many of the examples contain
minor C or C++ errors as well as non-idiomatic usage of the language.

For example, section 3.2 page 25, discussion of enumerated types is very
misleading in regards to what was possible in C and what is necessary
in C++.  They seem to insert ``typedef'' in structure and enum declarations
(almost at random).  Example:  Listing 3.2:

	#include <stream.h>

	typedef enum { red, green, amber} traffic_light_color;
	typedef struct intersection
	{
	  traffic_light_color traffic_light;
	  int number_cars_queued;
	  int cumulative_number_cars;
        };

	  // etc

[Any typos probably mine.]  By the way, they have this confusion about typedefs
and enums throughout the book.

I find their use of long class names in lower case (with underscores) hard
to read, although that is a less-important nit.  I would write the
preceeding as

	#include <stream.h>

	enum TrafficLightColor { Red, Green, Amber };
	struct Intersection {
	    TrafficLightColor traffic_light;
	    int               number_cars_queued;
	    int               cumulative_number_cars;
        };

which is a little easier to read, fonts aside.  The authors never use
capitalization for class names, which is the most common style.

Other places with problems:

Section 3.5 page 35, discussion of pointers:

	x = new float[ 1 ];
	y = new float[ 1 ];

Why would anybody in his or her right mind want to do this, rather than

	x = new float;
	y = new float;

?  The authors seem to be of the impression that new must always be of the
vector form.

Listing 4.12 page 76

	class outer_class
	{
	  private:
	    int y;
	    inner_class x;
	    inner_class r;
          public:
	    outer_class( int z );

	    void write() { printf( "\n%d", y ); }
	    void write_inner_x() { x.inner_class::write(); }
	    void write_inner_r() { r.inner_class::write(); }
        };

Now, I believe that the two write_inner_* methods are not well-formed C++,
and even if they were, what is wrong with x.write()?

Listing 4.18 pp. 87-88.  The use of simplify in class rational_number is
totally off-base.  It is a member function, declared as

	class rational_number
	{
	  // ...
	  private:
		void simplify( rational_number &num );
	  // ...
	};

but it is used and defined as if it were a normal function:

	simplify( *this );

This is ludicrous in the extreme.  Similar confusion about memberhood
abounds in the rational number example.
Look also at Listing 4.19 for the implementation of simplify.

I thought when I got this book that I finally had something I could give
to the many C programmers around here to introduce them to the language.
But the number of errors and misconceptions in the text make me hesitant
to use this book because I think it will just confuse people.  It is
vitally important in a teaching book that all the examples be not only
correct but also idiomatic.

Apologies to anyone who objects to the tone of this, well, flame.  I
guess I had my hopes up....


					Alexis Layton
					alex@CCA.CCA.COM

jima@hplsla.HP.COM ( Jim Adcock) (04/14/88)

| The book doesn't contain info on the latest 2.0 goodies.  I'd guess the book
| corresponds to about AT&T version 1.2.

By "2.0 goodies" I meant the "2nd batch of C++ features that Stroustrup discussed
extensively at the C++ Workshop and in his published papers."

The compilers that I have any exposure to are the AT&T 1.2 as implemented for the 
HP series 300, and g++ 1.18 as ported to HP series 300 by Glenn Engel.  These
compilers don't have the 2nd batch of goodies Stroustrup has talked about.

The Wiener and Pinson book has good correspondence to either of these compilers.

Sorry if some people are unhappy with the quality of programs in W+P, but I DID
say my review represented a quick scan over the book.  And I did say that I thought
the programs represented a medium quality programming effort.  I'm still glad I
got the book.

I have yet to note a consensus on proper C++ programming style, any more than the
C community rushed to rally around the Plum text to C style.

I still feel the large amount of "object oriented" examples in W+P verses the
almost total lack of "object oriented" examples in the Stroustrup make the W+P
a useful addition to my library.

rich@oxtrap.UUCP (K. Richard Magill) (04/21/88)

In article <6590036@hplsla.HP.COM> jima@hplsla.HP.COM (              Jim Adcock) writes:
>| The book doesn't contain info on the latest 2.0 goodies.  I'd guess the book
>| corresponds to about AT&T version 1.2.
>
>By "2.0 goodies" I meant the "2nd batch of C++ features that Stroustrup discussed
>extensively at the C++ Workshop and in his published papers."

Can I get some specific references?  In particular, I can't find
discussions of "private:", "protected:", etc.  in Stroustrup's book
yet the InterViews library uses them.  What are they?

For that matter, what are any of the other "2.0 goodies"?

mjy@sdti.UUCP (Michael J. Young) (04/22/88)

In article <3440@oxtrap.UUCP> rich@oxtrap.UUCP (K. Richard Magill) writes:
>In article <6590036@hplsla.HP.COM> jima@hplsla.HP.COM (              Jim Adcock) writes:
>>By "2.0 goodies" I meant the "2nd batch of C++ features that Stroustrup discussed
>>extensively at the C++ Workshop and in his published papers."
>
>Can I get some specific references?  In particular, I can't find
>discussions of "private:", "protected:", etc.  in Stroustrup's book
>yet the InterViews library uses them.  What are they?
>
>For that matter, what are any of the other "2.0 goodies"?

Actually, my edition of Stroustrup's book (which is pretty old, March 1986 --
there has been at least one more revision since then) makes reference to
features present in version 1.1 of cfront (e.g., pointers to member
functions).  Features from 1.2 and later are missing.

The "private" and "protected" keywords were added in version 1.2, and are
described in the 1.2 Release Notes.  Syntactically, they are similar to
the "public" keyword.  The "private" keyword specifies that subsequent class
members are private, just like they would be if "public" were never used
previously.  So it is now possible to have private members after public
members, as in:

	class foo {
	public:
	   int a;		// this member is publicly accessible
	private:
	   foo *link;		// don't even think of using this!
	   };

A "protected" member is treated as if it were public to any derived classes,
but private to other classes and functions.  Its main purpose is to provide
member access for inherited classes while not leaving the class vulnerable
to abuse from unrelated functions.

My understanding of the major enhancements of version 2.0 is support for
multiple inheritence and virtual new and delete operators, among other
things.
-- 
Mike Young - Software Development Technologies, Inc., Sudbury MA 01776
UUCP     : {decvax,harvard,linus,mit-eddie}!necntc!necis!mrst!sdti!mjy
Internet : mjy%sdti.uucp@harvard.harvard.edu      Tel: +1 617 443 5779
"Bill & Opus in '88" -- Consider the alternatives!