[comp.sys.mac.programmer] Beginning Mac Programming

mentat@auscso.UUCP (Robert Dorsett) (02/24/88)

In article <8W8QYby00Xc5AFE04R@andrew.cmu.edu> mw2k+@andrew.cmu.edu (Miles Asher Weissman) writes:
>
>	A few people on the net have mentioned that they would like to
>start programing with there Macs.  First a word of warning:
>
>	IT IS GOING TO COST A RESPECTABLE AMOUNT OF MONEY
>
>	The above should read ( about $200 + ).  The first thing all
>Mac programmers need is Inside Macintosh I-V ( yep that's right, all
>FIVE volumes costing between $20 and $27 each )  These tomes will in
>NO way teach you to program the Mac, it will simply tell you the routines
>and how to access them.

>	To actually learn programing on the Mac, there is a new book...

I've been programming the Mac since shortly after it was introduced, and have,
on occasion, helped/watched other people learn the Mac.  The following are
some observations:

1.  It WILL take a lot of money.  Depending on your language of choice, plus
documentation, at least $250, probably more.  More importantly, it will also
take TIME.  

2.  You IDEALLY should already know a programming language before attacking
the Macintosh.  However, many of the newer Mac compilers (Turbo Pascal, Light-
speed Pascal, Lightspeed C, etc) support a "vanilla" interface that separate 
the "formal" implementation from the Mac-level programming.  You can thus use
the Mac to learn how to program, without bothering with the fact that what
you're learning to program on is actually a Macintosh.  From there, most
compilers will provide a stepping stone to get "deeper."  Many easy-
to-use compilers also provide very powerful development capabilities (the
last two sentences aren't mutually inclusive: there are programming environ-
ments which let the user use some Mac concepts, while preventing them from
using others).

If you are a total novice at computers, and have no real computer background,
you might wish to forget all about it, and look at Hypercard, instead.  I 
know a number of people who have fiddled around with programming for years,
finally obtaining Hypercard, and being able to do exactly what they wanted
to, with a minimum of effort.  

As for the question of "what language is best", that's up to you.  For novices,
the Pascals are more useful, since the specifications and examples in Inside
Macintosh (see below) are in "pascal."  I personally find C (Lightspeed)
more useful, but I know people (all beginning C programmers) that find C's 
way of passing parameters and dealing with data structures a wee bit too 
difficult to resolve with the "Pascal" definitions in all the references.  
C has an advantage in that it's a systems programming language, and brings 
the user closer to the computer.  I don't have nearly as many "inexplicable" 
bombs since I switched to C, mainly due to the fact that one thinks in terms
of the machine representation of what one's working with, rather than abstract
concepts.  Other people might find that a disadvantage.
 
I do not recommend purchasing any of the BASIC's, unless you must.  BASIC
is an anachronism, and has no place on the Mac. (in my humble opinion)  If
you buy a BASIC, odds are that you'll find it unusable within days (if
you plan on doing anything fancy), and will be out another couple hundred
dollars for a Pascal or C compiler.

My apologies to those who have already developed a language preference...


3.  The "core" Macintosh reference is Inside Macintosh.  Inside Mac is the
definitive reference to the computer, the Toolbox, and the operating system.
The ToolBox and most of the OS is located on ROM chips in the computer.  I
do not agree that all five volumes are "essential" for programming.  That
would be approximately 2000 pages of information, and would relate to all
four computers (64K ROM Mac's, 128K ROM Mac's, SE's, and II's).  Approximately,
each is:
	Volume I: User Interface stuff, applicable to all Mac's.  Essential.
	Volume II: OS support stuff, applicable to all Mac's.  Useful, but 
	 	later on.
	Volume III: A summary of all the information in Volumes I and II.  It's
		pretty worthless, all told, but contains the INDEX for I 
		and II.
	Volume IV: Additional stuff in the 128K ROM's: Mac Plus.  It applies 
		to the SE and II as well.  Has its own index.
	Volume V: The SE and II.

Obviously, an "old Mac" owner need not bother with information about the Mac
Plus, SE, or II, and can easily get by with Volume I to begin with; Volume II 
as he gets more fancy (which could be days or months) ; and Volume III as he 
gets serious.  Programs written to the guidelines of Volumes I through III
will run (supposedly) on all Macintosh's.  

If you wish to buy volumes I-III at once, be aware that there's a bound 
hardcover version, containing all three volumes, out there somewhere.  You
might have to special-order from Addison-Wesley, but it exists.  The cost
in 1985 was $75 or so.  It has no structural advantage: it's literally 
volumes I-III, bound in sequence, merely in one package.  It's slightly more
convenient having everything in that one package, but my three-year-old,
well-used copy is starting to show its age (the spine is sagging, but pages
aren't coming out).


4.  The main source of ongoing information about the Macintosh are the 
Macintosh Technical Notes, which used to be distributed by Apple.  They are
now published by the Apple Programmer's and Developer's Exchange (see below).  
There are 200 or so Tech Notes, of varying quality.   Many describe pro-
gramming techniques; other detail bugs.  A few quite condescendingly teach
how to program.  They're quite useful, all told, and a hardcopy of each
should be obtained and bound in some manner.


5.  "Books" have varying appeal to people.  I know many people who buy books
like they're going out of style, start them, give up or find them inap-
propriate, and stick them on a shelf, to form a really impressive-looking
library.  If you must buy a book, by all means, borrow it from someone, or
check it out from a library first.  Computer books cost $30 a shot these
days (or more), and there are some real stinkers out there.  A lot of them
misrepresent themselves; most suffer from being "really really basic."  

Many of the "basic" books are not very well written, or take a "make it up
as we go along" attitude.  I know someone who is learning from a tutorial
for Turbo Pascal, which purports to teach how to program the Macintosh while
teaching Pascal, and never mentions how to initialize the Toolbox!  The
same book also has glaring typographical and conceptual errors in the 
simple program solutions students are supposed to compare their work with.

There are not very many "advanced" books.  My personal (hacker) attitude is
that nothing beats a good old reference manual.  Many people will disagree.
It's impossible to caution good judgement without sounding condescend-
ing, but I've seen a lot of money wasted on garbage.  One inevitable tendency
is for authors to "pad" books, print them on heavy-quality paper (usually with 
cheap glue), present a relatively small amount of original information, then 
go off on some tangent which isn't really related to the subject matter.

Do not expect to buy a book instead of Inside Macintosh.  Inside Mac, while
intimidating for many people, supplies a certain "structure" to the task of
learning how to program the Mac, and is certainly handy as an absolute 
authority for the inevitable typos. 

Do not expect to buy a book as a "manual" for a pirated development system,
and be able to advance to the "systems programming" level of the Mac.  Spend
the money for the real thing; if you choose your language/compiler carefully,
you'll get a good level of support and/or documentation.


6.  In the Good Old Days, Apple sold an "information package" to developers,
which (memory tells me) was $200 for Inside Mac, as it was being developed,
a bunch of utilities, etc, and a "published" version of Inside Mac when it
was released in 1985.  Apple took a bath on this, and pawned off the "infor-
mation distribution" to a branch of the Apple Puget Program Library Exchange, 
one of the largest Apple user groups on the planet.  The company thus formed 
was APDA, the Apple Programmer's and Developer's Association, which ostensibly 
is the easiest way to get Mac-related information.  The net has reported 
varying quality of support from APDA over the past year or so, but we don't 
really seem to have a choice in using it if we need current information.  To 
utilize their services (to buy from them), you have to be a "member", which is 
$20/year.  The address to write is:
	Apple Programmer's and Developer's Association
	290 SW 43rd Street
	Renton, WA  98055
They'll send you a fat catalog with all the goodies (some useful, some not),
if you ask nicely.  Beside Apple-originated products, they also try to 
sell as many third-party packages as possible.  In many cases, you can get
a better deal on these third-party packages mail order or through the Univer-
sity Consortium.


My overall recommendations in programming the Mac:

1.  Be sure you really want to.  Learn about the subject before spending any
money.  Decide what you want to do.  Resolve yourself to the fact that, if
you're a total novice, you won't be making professional-quality software for
a long time.

2.  Avoid interpreters (BASIC, MacPascal) like the plague.

3.  Buy at least Inside Mac I-III IF you intend on doing any systems program-
ming.  If you own a Plus, buy v. IV.  If you own a II or an SE, buy I-V.  

4.  Be skeptical with books that presume to "teach" how to "program" the 
Mac.  There ARE some good ones out there, but most are garbage.  Keep in 
mind that if you don't want to do any systems programming on the mac, but
just wish to "learn" a language (Pascal, C, BASIC, etc), there are books
written about the language proper, which are of *no* relevance to the Mac,
and which are entirely suitable (and probably better-written) for learning.

5.  If you're experienced, go straight to Inside Mac, get the APDA catalog,
and make your own decisions from there on how you want to learn. 






-- 
     Robert Dorsett        {allegra,ihnp4}!ut-emx!walt.cc.utexas.edu!mentat
University of Texas 	   {allegra, ihnp4}!ut-emx!auscso!mentat  
          at Austin	   mentat@walt.cc.utexas.edu

pkahn@meridian.ads.com (Phil Kahn) (02/28/88)

First, Transkel sounds very useful. Could someone describe it a bit
and let me know where it can be found?

Second, I am a new (home) owner of a MAC II who is just plunging into
the guts to begin programming.  I have an academic computer science
background and have over a million lines of code (academic and
engineering). Point is, I'm a bit inundated by all the books at this
point (though, that always seems to be the case).  Essentially, I want
access into the graphics, windows, text, mouse, and event handling.
I just got IM 1-3 and 5; I couldn't see a need for 4 which seemed to
be Plus specific. Macintosh Programming Secrets has been recommended
and bought. Are both volumes of Macintosh Revealed useful? Volume 2
seemed to be the one that gets cracked and old from use. And what
about these books that only talk about the Toolbox? They sound useful,
but no mention has been made yet on this digest.

Thanks,
phil...

cs178aas@sdcc8.ucsd.EDU (Grobbins) (02/29/88)

In article <2565@auscso.UUCP> mentat@auscso.UUCP (Robert Dorsett) writes:
>BASIC is an anachronism, and has no place on the Mac.  If
>you buy a BASIC, odds are that you'll find it unusable within days (if
>you plan on doing anything fancy), and will be out another couple hundred
>dollars for a Pascal or C compiler.

Not true.  ZBasic produces perfectly Mac-like applications, yet using 
it requires no knowledge of Inside Mac.  It is a fast compiler, and 
provides nearly full toolbox access.  While ZBasic is no substitute 
for a full Pascal or C compiler for commercial applications, it's among 
the fastest ways to get a good, professional program up and running on 
the Mac, especially for someone with no desire to invest several
months learning the ins and outs of Mac programming.

Grobbins              grobbins%sdemlab@ucsd.edu

han@Apple.COM (Byron Han, fire fighter) (03/01/88)

In article <2694@zodiac.UUCP> pkahn@meridian.UUCP (Phil Kahn) writes:

>I just got IM 1-3 and 5; I couldn't see a need for 4 which seemed to
>be Plus specific. Macintosh Programming Secrets has been recommended
>and bought. Are both volumes of Macintosh Revealed useful? Volume 2
>seemed to be the one that gets cracked and old from use. And what
>about these books that only talk about the Toolbox? They sound useful,
>but no mention has been made yet on this digest.

Volume 1,2 are needed.  Volume 3 no really - just an index for 1 and 2.
Volume 4 is needed for MacPlus specific stuff (which also applies to SE/II)
Volume 5 is SE and II specific stuff.

The MacRevealed stuff is great if you are a beginner.  After delving into
the deeper mysteries of Macintosh, it will prove less useful.

Programming the Macintosh with MPW by Joel West is also good.

Macintosh Programming Secrets by Scott Knaster is good after you've been
programming a while.

Hope this helps.

I have no connection with anyone except Apple where I work.  This is NOT
an official Apple endorsement or recommendation.  Just my own.

-- 
------------------------ Byron Han,  Communications Tool ----------------------
     Apple Computer, Inc.  20525 Mariani Ave, MS 27Y  Cupertino, CA 95014
 ATTnet:408-973-6450    applelink:HAN1    domain:han@apple.COM     MacNET:HAN
GENIE:BYRONHAN   COMPUSERVE:72167,1664   UUCP:{sun,voder,nsc,decwrl}!apple!han

dtw@F.GP.CS.CMU.EDU (Duane Williams) (03/01/88)

Some people have commented that volume 5 of Inside Macintosh is SE and Mac
II specific.  But, many of the features described in v.5 are available on
the Mac Plus via patches in the new System.  So, Mac Plus programmers need
v.5 also, if they want to take advantage of all the features available to
them.

lippin@spam.berkeley.edu (The Apathist) (03/01/88)

	I've seen several articles lately saying that Volumes IV and V
of Inside Mac are machine specific.  While there is some truth to this
(particularly in the color sections of V), both books have lots of
information useful on the older Macs.  Almost all of volume IV, and
most of the non-color stuff in volume V are supported by patches in
the latest system files on older Macs.  Of course, if your machine is
suitably ancient (128K and maybe 512K), Apple recommends tthe older
systems.  But there's no problem putting, for example, hierarchical
menus on a 512KE.

	On the other hand, a beginner might be able to get away with
just volume I.  I'd recommend reading the all-text sections of each
chapter, and skipping the routine descriptions until you're ready to
use them.  This shouldn't take too long to read, and requires little
programming expertise to follow (I think).

	If you want to learn a language at the same time, get a book
that has nothing to do with any particular computer; it will likely be
better written, as it only has to approach one problem.

						--Tom Lippincott
						..ucbvax!bosco!lippin

		"Foo!  You are nothing but a charlatan!"
						--Adventure

lsr@Apple.COM (Larry Rosenstein) (03/02/88)

In article <2565@auscso.UUCP> mentat@auscso.UUCP (Robert Dorsett) writes:
>
>	Volume III: A summary of all the information in Volumes I and II.  It's
>		pretty worthless, all told, but contains the INDEX for I 
>		and II.

At MacWorld Expo there was an Inside Macintosh XREF, which contained an
index to all 5 volumes.  I don't think this has been officially published
yet, but it might satisfy the need to get volume 3.

>gets serious.  Programs written to the guidelines of Volumes I through III
>will run (supposedly) on all Macintosh's.  

The only possible exception to this rule is the hierarchical file system,
which is described in volume 4.  There are some things you have to watch out
for, if your program is going to run on an HFS system.  (For example, the
Poor Man's Search Path.)

>4.  The main source of ongoing information about the Macintosh are the 
>Macintosh Technical Notes, which used to be distributed by Apple.  They are
>now published by the Apple Programmer's and Developer's Exchange (see
>below). 

Tech Notes  are freely available, although subscribing to them from APDA
ensures that you get the new batches as they appear.  I believe these are
available from Info-Mac and from BBS's.

>3.  Buy at least Inside Mac I-III IF you intend on doing any systems program-
>ming.  If you own a Plus, buy v. IV.  If you own a II or an SE, buy I-V.  

I would buy volume 4 before 3.  And you can wait on buying 5, unless you
have a Mac II and want to program with color.


I would add to the suggestions that you should locate a user group with a
programming sub-group.  Most user groups do have a developer groupd with
separate meetings.  There is no substitute for asking questions of someone
who has been down the same path before.



-- 
		 Larry Rosenstein,  Object Specialist
 Apple Computer, Inc.  20525 Mariani Ave, MS 32E  Cupertino, CA 95014
	    AppleLink:Rosenstein1    domain:lsr@Apple.COM
		UUCP:{sun,voder,nsc,decwrl}!apple!lsr