Bitwise Operator
by Matt Slot
An Introduction to Macintosh Programming
Everybody at Ambrosia has a role to fill. Andrew is our fearless leader, and he writes articles for the Ambrosia Times with passion and insight regarding the current state of the Macintosh in general. Cajun provides technical support to our users, so his contributions invariably demonstrate ways to use the Macintosh more effectively. Gayle is the "grown-up" that keeps all us rowdy guys in line, and her articles are uniquely feminine.
In that vein, my first contribution starts a series of articles designed to teach the basics of software programming to students and interested users. This means an overview of the process, as well as simple tutorials that will help you start coding quickly. While I don't have the time to teach a large number of people the equivalent to years of education and experience, I can use these articles to point you in the right direction for getting development tools, references, and of course, help.
For this general introduction, I'll describe some of the fundamental tools and reference books that you should consider purchasing, as well as useful and free online resources.
What Do You Need?
The fundamental requirements for developing software on any computer are the hardware and software. We assume that you have access to a Macintosh computer, since you are already an Ambrosia fan. The primary development are all commercial: Metrowerks CodeWarrior, Symantec C++, and Macintosh Programmer's Workshop (MPW).
The Big Three
Metrowerks CodeWarrior C/C++ is available for both commercial use ($399) or for academic use ($119, with student ID). The only difference between is the license -- the academic version can only be used to create free or shareware products. The CodeWarrior CDs include compilers, sample source code, and various electronic programming tutorials and references. CodeWarrior has quickly become the development environment of choice.
Symantec C++ for the Power Macintosh has fallen behind the competition a bit, although it contains many of the features of CodeWarrior and is still used widely. It was previously called "THINK C"
Apple's MPW is one of the early tools for development on the Macintosh, and provides a command-line interface and extensible tools to automate various tasks. MPW is available from Apple as part of ETO (Essential Tools and Objects), but it also comes bundled with the CodeWarrior and Symantec packages.
http://www.metrowerks.com/products/cw/mac/
http://www.symantec.com/scpp/fs_scpp85_mac.html
http://devtools.apple.com/eto/
Other Options
For cheaper alternatives, there are some lesser used software packages such as VIP-C from MainStay software, AbSoft Fortan, and PowerFantasm.
http://www.mstay.com/products/vc20_ab1.html
http://www.absoft.com/pro.fortran.html
http://mirrors.aol.com/pub/info-mac/dev/power-fantasm-415.hqx
Finally, if you can't afford to purchase any of the packages listed above, you might consider purchasing an older version from another user who no longer is using it. For example, the Metrowerks CodeWarrior subscription provides the buyer with 2 free renewals. After the subscription expires, the user may either update the subscription at a discount -- unless there have been intermediate releases, in which case the user must purchase a completely new subscription.
If a user purchases a new subscription, and does NOT upgrade an existing one, he can sell (or give) the older version and its license to another user. In this way, a user may be able to get an older but still usable version of CodeWarrior for relatively little investment. NOTE: The buyer should validate that the license has in fact been transferred to himself. Also, Metrowerks will not upgrade older versions of CodeWarrior at a discount -- if you plan on upgrading, you must purchase a completely new license. (You should contact Metrowerks directly if you have any questions regarding these issues.)
Getting Started
Once you have a computer and the development environment you hope to use, you need to start learning -- both a programming language and the basics of Macintosh programming. Finally, you'll eventually want a place where you can go to ask your programming questions.
Tutorials and Reference
The first place you should look for more information is at the bookstore. There are several very good tutorials and reference books to gradually introduce users to both programming and the Macintosh.
"Learn C on the Macintosh: Volume 1" -- Dave Mark
"Foundations of Mac Programming" -- Dan Parks Sydow
Users will also find reference books handy, for looking up specific information beyond the scope of the tutorial. The primary reference set for Macintosh Programming is the "Inside Macintosh" collection published by Addison-Wesley. There are also references for specific programming languages:
"Inside Macintosh: Overview"
"Inside Macintosh: Memory"
"Inside Macintosh: Macintosh Toolbox Essentials"
"The C Programming Language, 2nd Edition" -- Kernigan, Ritchie
After gaining a bit of experience, users will want to experiment with new projects and explore various areas of Macintosh Programming.
"Learn C on the Macintosh: Volume 2" -- Dave Mark
"(MacWorld) Ultimate Mac Programming" -- Dave Mark
"Tricks of the Mac Game Programming Gurus" -- Dugan, McCornack, Ragnemalm
"Black Art Of Mac Game Programming" -- Kevin Tieskoetter
As stated before, Metrowerks CodeWarrior comes with several online books and references. Be sure to look through the CDs for lots of hidden information. Apple references and technotes are available on CD and online at the Apple Web site. MacTech magazine sells THINK Reference, an online database of MacOS functions and sample code. Finally, Peter Lewis offers a lightweight shareware package called ObiWan which is useful as a MacOS function reference.
http://www.devworld.apple.com/
http://www.devworld.apple.com/dev/insidemac.shtml
http://www.devworld.apple.com/dev/technotes.shtml
http://www.mactech.com/cdrom/
http://www.share.com/peterlewis/obiwan/
Finding Help
Of course software programming isn't trivial, and everyone eventually needs to ask questions. There are a large number of places to meet friendly people who are willing to answer even dumb questions, and provide you with pointers to more information and sample code.
The first thing I would recommend when you have questions or problems is to browse the UseNet Frequently Asked Questions (FAQ) lists. They are written as question/answer pairs for the most common issues programmers face.
ftp://mirrors.aol.com/pub/info-mac/per/csmp/
ftp://mirrors.aol.com/pub/info-mac/info/dev/
ftp://mirrors.aol.com/pub/rtfm/usenet/
Next, users can get reasonably fast responses to their questions using the UseNet bulletin boards. Another place for getting help is using the IRC chat network (requires ircle or similar software).
http://devworld.apple.com/community/usenet.html
news:comp.sys.mac.programmer.help
news:comp.sys.mac.programmer.misc
news:comp.sys.mac.programmer.games
news:comp.sys.mac.programmer.codewarrior
ftp://ftp.ircle.com/pub/ -- IRC channel #macdev
Finally, Apple maintains several mailing lists that are dedicated to specific technologies (QuickTime, OpenDoc) or to other developer issues.
http://www.devworld.apple.com/community/mailing.html
Even More Information
Finally, I'd like to wrap up this discussion with a list of additional places to get information. After following some tutorials and reading the references, users are encouraged to download sample code or developer kits and expand their skills:
http://www.devworld.apple.com/dev/sdk.html
http://www.devworld.apple.com/dev/sc.html
http://www.devworld.apple.com/dev/toc.shtml
ftp://mirrors.aol.com/pub/info-mac/dev/
ftp://mirrors.aol.com/pub/mac/development/
http://www.celestin.com/apprentice/
There are also a number of good sites devoted to many aspects of Macintosh programming. They contain great information, sample code, and pointers to other valuable sites.
http://www.ambrosiasw.com/alt.sources.mac/
http://www.catambay.com/pascal-central/
http://www.mactech.com/magazine/urls/
http://med-amsa.bu.edu/Pharmacology/pharm.people/Lee/MacProg.html
Closing
Well this article turned into a long list of references, but I think that anyone who is interested in coding will find each of these places contains valuable information. My future articles will consist of short tutorials and references for specific techniques that are essential to Mac programming.
In my opinion Ambrosia doesn't just make cool games, we make computers fun and easy to use. These articles are just another way that I can help you master your macintosh.
Matt Slot, Bitwise Operator
Ed Note -- So far, Matt's been handling the Rochester weather just fine. Being from Michigan, he's pretty used to it. He is finding that we have some bonehead drivers here. Don't people know is gets slippery when there's snow on the ground? It's defensive driving in its greatest capacity here in Rochester. Beware Matt!