Programming on the Mac
Why bother programming for an "ancient" OS? First of all, it's a very rewarding experience. It'll teach you a thing or two about how computers and programming works. And you and your work will receive the attention of the Mac OS community.
What programming language to choose?
Depends on your prior knowledge & goal.
A programming novice:
Try RealBasic. Or AppleScript. If all else fails, try Hypercard.
A programming intermediate:
Go with C / C++ or Pascal.
What, Pascal? Yeah, Pascal used to be the "lingua franca" of the Macintosh during all of the 80s and early 90s. MacWrite and MacPaint were developed in Pascal on an Apple Lisa. (Reason was that the Lisa had a compiled version of Pascal while the Mac had not until 1986!).
A lot of great software was written in Pascal. You can find Pascal-remnants all over Mac OS. Ever wondered why a dialog box had a limit of 255 characters? Well, there's a certain Pascal class ...
Toolchain! What IDE / compiler / linker to use?
Looking for a fully-fledged IDE that spares you lots of work? Sorry - you're out of luck.
The thing coming closest to is probably the CodeWarrior IDE. This is pro software and not something you learn to fully understand in 20 minutes. (check out our tutorial on how to set it up)
Another popular choice is MPW (Macintosh Programmer's Workshop), though by comparison that is "bare bones". Some folks love Think C or Think Pascal. And if you're really looking for a challenge / want to code timing-critical stuff for 68k Macs, pick up a 68k assembler like Fantasm.
Your best choice is to check the Development Tools section of the Macintosh Garden. Try out stuff until you find something you feel comfortable with. Start with the ones mentioned above.
Unfortunately, nobody ever undertook the endeavor to build up a full online documentation on developing for Mac OS. However, you can find all the answers to your question in Apple's "Inside Macintosh" manuals. This series of documents is available online and basically covers everything from the Toolbox calls necessary to initialize the Mac menu bar to stuff like Open Transport networking.
Just don't expect to copy & paste code a la Stack Overflow - programming Mac OS is *real* programming. Remember about learning a thing or two?
Source code examples
Here are a few open source examples for various languages / compilers. Feel free to download and tinker with them:
|Abuse||C||PC & Mac source for the Run & Gun game Abuse|
|Stunt Copter||Pascal||80s Mac arcade gaming classic|
|Tetris Light||C||A simple Tetris implementation|
|Desert Trek||Pascal & C||A reimplementation of an Oregon Trail style game|
Looking for a boilerplate that initializes the basic functionality and lets you play around? I've slammed together the Mac OS Today Boilerplate. Compile with Codewarrior.
Lots of Pascal stuff can be found on Ingemar Ragnemalm's corner on Pascal Central.