[comp.sys.mac.programmer] "C Programming Techniques for the Macintosh" warning!

chuq@Apple.COM (Chuq Von Rospach) (04/13/89)

Here's a cautionary note for people looking for C books. There's a new
edition of "C Programming Techniques for the Macintosh" by Zigurd and Terry
Mednieks (Sams). The new edition has rewritten the material to work with
ResEdit and LightSpeed C instead of Redit and MacC. This makes it (as far as
I know) the first generally available LSC book out there.

Since I've actually been sitting down and seriously trying to do some Mac
programming in LSC the last couple of weeks, the book looked interesting. I
was involved peripherally in the first edition (you'll see my name in the
acknowledgements) and I thought it'd be a good book to hack with.

Unfortunately, the book has some major problems. The primary application it
uses as an example is a Mandelbrot set (in grays, not color...). This
application is listed twice: in Chapter 8 as a basic application, and in
chapter 9 including file open/save, printing and a few extra goodies. 

I spent a day typing in all 1200 lines of code from the first example. After
a couple of days of tracking down the various obligatory typos from that
much brute-force typing, I found that the program was still buggy -- to the
point of bombing the mac out from under the LSC source level debugger. Not
nice. Since I was pretty sure that I got all of *my* typos, I started
looking for other bugs. 

I found them. Lots of them. By comparing the same routines in the Chapter 8
and Chapter 9 sources, I found about 30 different bugs or significant
revisions -- even though the program in chapter 8 is only supposed to be a
subset of the full program. Many of the bugs are exceptionally stupid,
sloppy ones (using resedit to create a dialog box with visible turned off,
which causes the dialog to go bang when you try to use it; another was
mixing up the window resize procedures so that when you resize a window
vertically, you turn on the horizontal scrollbar and vice-versa!). The
*only* thing I can think of is that when the book got laid out they
accidentally used an obsolete version of the code for that listing. It's
pretty worthless -- although, fortunately, the (mostly) corrected source is
available in chapter 9 [which actually makes me wonder why they wasted the
pages printing the same stuff twice, but that's another issue....].

There are other problems with the book. The design of the mandelbrot
calculation doesn't allow for giving time to the system -- so things like
menubar clocks or Desk Accessories don't get any resources unless you toss
an event at the system, since SystemTask() is only called in the event loop.
The book was written for pre-LSC 3.0, so there's no discussion of the
source-level debugger or any of the new features. The resource generation is
shown by Resedit screendumps, but some of them are wrong and they don't
explain how to use ResEdit -- if you don't know going in, you're going to be
totally confused.

All in all, this edition is significantly MORE buggy than the first edition
and less useful for everyone -- even though it's been converted to a
compiler that is still in production, you would have been better off with
the old book and making the changes yourself -- the first book, at least,
wasn't buggy like this.

The bottom line is this: if you're looking for a C book, look somewhere
else. There *is* an LSC book due out any minute -- one that is supposed to
cover release 3.0 -- and you're much better off waiting for it or buying the
Takasuka book and figuring out the differences between MacC and LSC. This
book has so many problems it's not worth trying to fix. Maybe if they come
out with a new-new edition with unbuggy code, but not in the current format.









Chuq Von Rospach       -*-      Editor,OtherRealms      -*-      Member SFWA
chuq@apple.com  -*-  CI$: 73317,635  -*-  Delphi: CHUQ  -*-  Applelink: CHUQ
      [This is myself speaking. No company can control my thoughts.]

USENET: N. A self-replicating phage engineered by the phone company to cause
computers to spend large amounts of their owners budget on modem charges.

rieman@boulder.Colorado.EDU (John Rieman) (04/13/89)

I second the warning on Zigurd R. Mednieks / Terry M. Schilke's
book.  I only have the first edition, and it did help me to
get some code running -- but the more I worked with the code
and InsideMac, the more problems I found.  Superfluous toolbox
calls, calls in the wrong place, etc.   I can't comment on the
second edition.

-JR

holland@m2.csc.ti.com (Fred Hollander) (04/13/89)

In article <28861@apple.Apple.COM> chuq@Apple.COM (Chuq Von Rospach) writes:
>Here's a cautionary note for people looking for C books. There's a new

[bugs, typos, bad programming comments deleted]

>The bottom line is this: if you're looking for a C book, look somewhere
>else. There *is* an LSC book due out any minute -- one that is supposed to
>cover release 3.0 -- and you're much better off waiting for it or buying the

So tell us more.  Who's writing this great new book?

Fred Hollander
Computer Science Center
Texas Instruments, Inc.
hollander@ti.com

The above statements are my own and not representative of Texas Instruments.

rht@smsdpg.uu.net (Randy Thompson) (04/29/89)

From article <74631@ti-csl.csc.ti.com>, by holland@m2.csc.ti.com (Fred Hollander):
> In article <28861@apple.Apple.COM> chuq@Apple.COM (Chuq Von Rospach) writes:
>>Here's a cautionary note for people looking for C books. There's a new
> 
> [bugs, typos, bad programming comments deleted]
> 
>>The bottom line is this: if you're looking for a C book, look somewhere
>>else. There *is* an LSC book due out any minute -- one that is supposed to
>>cover release 3.0 -- and you're much better off waiting for it or buying the
> 
> So tell us more.  Who's writing this great new book?
> 

I dont know that I would call the book great, or even if it is the book
that is referred to above, but I picked up:

	Macintosh Programming Primer
	"Inside the Toolbox Using LightSpeedC"
	by Dave Mark & Cartwright Reed
	Published by Addison Wesly

at the MacWorld DC show. I havent had much time to go through it yet.

It is designed to be an introductory Mac C programming tutorial. I have
only read about 70 pages but is seems pretty good (to a novice). It is
well written and is one of the first books on this subject that I can 
readily understand. (I get the feeling that I am not alone in my search
for a Mac C introductory document) I have not yet had the time to 
try any of the sample code but it was written for use with LSC 3.x and
has a pretty good tutorial on the use of ResEdit. It does _NOT_ teach 
C programming and assumes that the user has at least a rudimentary 
knowledge or at the very least a companion testbook.

If there is enough interest, I will post a (biased??) review when I have
completed the book in about 2 weeks.
___________________________________________________________
Randy Thompson                             uunet!smsdpg!rht
SMS Data Products Group, Inc.                   -  or  -   
703/648-9400                                rht@smsdpg.UUCP
___________________________________________________________