TweetFollow Us on Twitter

Getting Started: Circa 2002

Volume Number: 18 (2002)
Issue Number: 11
Column Tag: Getting Started

Getting Started: Circa 2002

by Dave Mark

I have to tell you, it feels great to be back. It's been a little more than five years since my last Getting Started column, but it feels like an eternity. The long and winding road from the days of Inside Macintosh, Nubus cards, black and white monitors, GetPort() and SetPort(), trap patching, 68K emulation, etc. has turned a radical new corner.

Though the vast majority of all Macs still run System 9 or earlier, the future is clear. This is a unique moment in time and you have a unique opportunity. Back in the frontier days of Macintosh development, an unusual mix of elements was taking shape. There was a wonderful new computing platform that freed you from the traditional bonds of DOS. Instead of a limited (and frequently cryptic) set of commands that governed your interaction with your computer, applications such as MacWrite and MacPaint allowed you to express yourself in revolutionary new ways.

As with any revolutionary change, opportunities blossomed. People loved the Macintosh and, as word spread, their hunger for new applications grew dramatically. Problem was, developing a Mac application was completely different than the relatively simple process of building a DOS or Unix app. Back in the day, Inside Macintosh was a single volume that came in a loose leaf binder, and deciphering its mysteries required dedication and a great deal of trial and error. But, for those "in the know", there was money to be made. Startups were everywhere. This was fertile ground. Exciting times.

I loved those early days. The excitement of learning about something so new and so beautifully crafted inspired me. And once I understood the basics, I felt compelled to share my knowledge with the Mac development community. I wrote books like the Macintosh Programming Primer series, Learn C on the Macintosh and, of course, 7 years worth of Getting Started columns for MacTech.

Over time, each new release of the Mac OS brought less dramatic changes and the process moved from revolutionary to evolutionary. As the process of building a Mac application became less mystical and more practical, money came to the table and getting a Mac application to market and competing with established brands became harder and much more expensive. What was once a fun, "programming for the beauty of it" process moved from the computer science end of the spectrum to the marketing end of the spectrum. The pioneer days were dead.

And now we've come full circle. Mac OS X is a whole new beast. New APIs to learn, a new development environment to explore, new widgets to play around with. We've got a whole new frontier to explore and there are opportunities here for all of us.

Getting Started

There are a number of paths to explore here. We'll start with the most straightforward, building an app using the Objective C programming language and Apple's Cocoa framework. Over the coming months, we'll dig into the basics of Objective C. Over time, we'll take on Cocoa and, eventually, explore some of the other paths to build our Mac OS X apps. I'd also like to spend some time under the hood, exploring the OS upon which Mac OS X is based, Apple's port of the Unix operating system.

Go get the tools

There are a number of good choices out there when it comes to development tools. There's CodeWarrior from Metrowerks, REALbasic from REAL Software, a variety of AppleScript environments, and many others. For the moment, we're going to focus our attention on the tools that Apple provides, gratis, to ensure we all start on the same footing.

    When Apple bought NeXT back in December of '96, they got Steve Jobs back and they also got Steve's OS and the development tools crafted to work alongside the OS. The OS evolved into Mac OS X, and the tools became Apple's official Mac OS X dev tools.

Many of you already have Apple's dev tools in hand. Newer Macs ship with a Developer Tools CD. You may find that your Mac came with the tools pre-installed. Nonetheless, go through the web site, download the latest and greatest, and install them on your machine.

First step: Navigate to:

http://developer.apple.com

This is the home for the Apple Developer Connection, also known as ADC. There is a ton of great material on this site. You can sign up for Apple's various developer programs, including the Premier (US$3500 per year), Select (US$500 per year), Student (US$99 per year), Mailing (US$199 per year), and Online (FREE) programs. Take some time to go through the program descriptions to see if one of them is right for you.

To get the tools, all you have to do is register for the Online program. To register, send your browser to:

http://connect.apple.com

Click the "Join" button, read the license, click "Agree", then fill out the form and select your new Apple ID. Once your account is set up, log in, then select Download Software from the nav bar on the left hand side of the ADC window. Next, click Mac OS X from the sub-nav bar (Figure 1).


Figure 1. Click the Download Software link, then Mac OS X

There are a lot of choices on this page. As I write this, the latest releases are the July 2002 Mac OS X 10.2 Developer Tools and the August 2002 Dev Tools 10.2 Update. By the time this column gets to you, however, there may be a new release of the tools or another update. As a rule, download the most recent Developer Tools package first. Then, check to see if an Update package was released after the Developer Tools package. If so, download it as well. Install the Developer Tools package and the Update, if applicable.

Checking the Install

Once the tools are installed, you should have a directory named Developer at the top level of your hard drive. My Developer directory listing is shown in Figure 2. Take a few moments to go through the various Developer sub-directories.


Figure 2. The Developer directory after the tools install.

In the Applications directory, you'll find a number of interesting tools, including one we'll fire up in just a sec called Project Builder. For you CodeWarrior fans, Project Builder is sort of the equivalent of the CodeWarrior IDE, a command central for all your project files and the application that actually calls the compiler and other code building tools.

The Documentation folder is also filled with important goodies. Get to know what docs are available. There's a lot of good reading in there, and it's all free. One short file worth reading is the README.html file in the Documentation directory. This file will open in your web browser and lists various ways to access the documentation from within Project Builder.

If you'd like to get ahead of the game, take a look at the file:

/Developer/Documentation/Cocoa/ObjectiveC/ObjC.pdf

ObjC.pdf will give you a fairly thorough grounding in the Objective C language.

Take 'em For a Spin

Now that the tools are installed, let's take them for a spin. This month's project will be a simple C "Hello World" project, just to get a sense of the environment. Next month, we'll try our hand at some Objective C code.

Navigate into the /Developer/Applications folder and launch Project Builder. Select New Project... from the File menu. The New Project dialog appears, allowing you to specify the type of project you'd like to build. Scroll all the way to the bottom and select Standard Tool (Figure 3). Standard Tool builds an ANSI C command line program. Click the Next button.


Figure 3. Select the Standard Tool project template.

You'll be prompted for a directory in which to store all the project related files (Figure 4), including all source, object, and binaries. Name your project Hello World, then click the Choose... button to browse on your hard drive for a location for the Hello World folder. I created a Projects folder within my personal folder rather than storing the projects within the /Developer directory. I don't want to wipe out my projects when I decide to do a wipe and reinstall of the dev tools.


Figure 4. Saving your new project files.

Now click the Finish button. Project Builder will build a project for you, complete with a source code file named main.c containing a main() function any C programmer will recognize in a heartbeat.

The project window that appears contains a number of elements. We'll get into them in detail in next month's column. For now, the important elements are the "Groups & Files" pane, the code editing pane, and the toolbar (at the top of the window, the one with all the funny hammer icons).

In the "Groups & Files" pane, click on the disclosure triangle to the left of the Source folder icon. You'll reveal a single file named main.c within the Source group. Click on main.c. Notice the source code that appears in the code editing pane (Figure 5).


Figure 5. The Hello World source code listed in the project window's code editing pane.

Let's run this sucker. Click on the 3rd icon in the toolbar (the one with the hammer covered by a computer display). If you hover over the icon, a tooltip appears with the words "Build and run active executable". That's the one we want. This will compile our source, link our object code into an executable and run the executable. Do it.

Your result should be eerily similar to the one shown in Figure 6. Cool!


Figure 6. Hello World does its thing.

When you asked Project Builder to build and run your project, Project Builder did just that. If you click in the Window menu, you'll see three sub-items under the "Hello World - (Hello World)" item. The one selected in Figure 7 is the Build window. Under that is the Project window (in this case, listing the main.c source code). Under that is the Run window showing the output of the program execution.


Figure 7. Project Builder's Window menu.

You can close any of these windows at any time, though you'll likely want to keep the project window open so you can make changes to your source code and build and run your app.

Till Next Month...

Want to play some more? Good! Try making some changes to the source code. Got an old copy of Learn C on the Macintosh lying around? Try typing in some of that source code. And if you are really adventuresome, take the debugger for a spin. Hint: The tooltip for the 2nd icon from the left in the project window's toolbar says "Build and debug active executable".

Next month, we'll go through Project Builder in a bit more detail and go through the debugger as well. It's good to be back - Thanks for reading!


Dave Mark is very old. He's been hanging around with Apple since before there was electricity and has written a number of books on Macintosh development, including Learn C on the Macintosh, Learn C++ on the Macintosh, and The Macintosh Programming Primer series. Dave maintains a primitive web site at http://www.spiderworks.com

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Tokkun Studio unveils alpha trailer for...
We are back on the MMORPG news train, and this time it comes from the sort of international developers Tokkun Studio. They are based in France and Japan, so it counts. Anyway, semantics aside, they have released an alpha trailer for the upcoming... | Read more »
Win a host of exclusive in-game Honor of...
To celebrate its latest Jujutsu Kaisen crossover event, Honor of Kings is offering a bounty of login and achievement rewards kicking off the holiday season early. [Read more] | Read more »
Miraibo GO comes out swinging hard as it...
Having just launched what feels like yesterday, Dreamcube Studio is wasting no time adding events to their open-world survival Miraibo GO. Abyssal Souls arrives relatively in time for the spooky season and brings with it horrifying new partners to... | Read more »
Ditch the heavy binders and high price t...
As fun as the real-world equivalent and the very old Game Boy version are, the Pokemon Trading Card games have historically been received poorly on mobile. It is a very strange and confusing trend, but one that The Pokemon Company is determined to... | Read more »
Peace amongst mobile gamers is now shatt...
Some of the crazy folk tales from gaming have undoubtedly come from the EVE universe. Stories of spying, betrayal, and epic battles have entered history, and now the franchise expands as CCP Games launches EVE Galaxy Conquest, a free-to-play 4x... | Read more »
Lord of Nazarick, the turn-based RPG bas...
Crunchyroll and A PLUS JAPAN have just confirmed that Lord of Nazarick, their turn-based RPG based on the popular OVERLORD anime, is now available for iOS and Android. Starting today at 2PM CET, fans can download the game from Google Play and the... | Read more »
Digital Extremes' recent Devstream...
If you are anything like me you are impatiently waiting for Warframe: 1999 whilst simultaneously cursing the fact Excalibur Prime is permanently Vault locked. To keep us fed during our wait, Digital Extremes hosted a Double Devstream to dish out a... | Read more »
The Frozen Canvas adds a splash of colou...
It is time to grab your gloves and layer up, as Torchlight: Infinite is diving into the frozen tundra in its sixth season. The Frozen Canvas is a colourful new update that brings a stylish flair to the Netherrealm and puts creativity in the... | Read more »
Back When AOL WAS the Internet – The Tou...
In Episode 606 of The TouchArcade Show we kick things off talking about my plans for this weekend, which has resulted in this week’s show being a bit shorter than normal. We also go over some more updates on our Patreon situation, which has been... | Read more »
Creative Assembly's latest mobile p...
The Total War series has been slowly trickling onto mobile, which is a fantastic thing because most, if not all, of them are incredibly great fun. Creative Assembly's latest to get the Feral Interactive treatment into portable form is Total War:... | Read more »

Price Scanner via MacPrices.net

Early Black Friday Deal: Apple’s newly upgrad...
Amazon has Apple 13″ MacBook Airs with M2 CPUs and 16GB of RAM on early Black Friday sale for $200 off MSRP, only $799. Their prices are the lowest currently available for these newly upgraded 13″ M2... Read more
13-inch 8GB M2 MacBook Airs for $749, $250 of...
Best Buy has Apple 13″ MacBook Airs with M2 CPUs and 8GB of RAM in stock and on sale on their online store for $250 off MSRP. Prices start at $749. Their prices are the lowest currently available for... Read more
Amazon is offering an early Black Friday $100...
Amazon is offering early Black Friday discounts on Apple’s new 2024 WiFi iPad minis ranging up to $100 off MSRP, each with free shipping. These are the lowest prices available for new minis anywhere... Read more
Price Drop! Clearance 14-inch M3 MacBook Pros...
Best Buy is offering a $500 discount on clearance 14″ M3 MacBook Pros on their online store this week with prices available starting at only $1099. Prices valid for online orders only, in-store... Read more
Apple AirPods Pro with USB-C on early Black F...
A couple of Apple retailers are offering $70 (28%) discounts on Apple’s AirPods Pro with USB-C (and hearing aid capabilities) this weekend. These are early AirPods Black Friday discounts if you’re... Read more
Price drop! 13-inch M3 MacBook Airs now avail...
With yesterday’s across-the-board MacBook Air upgrade to 16GB of RAM standard, Apple has dropped prices on clearance 13″ 8GB M3 MacBook Airs, Certified Refurbished, to a new low starting at only $829... Read more
Price drop! Apple 15-inch M3 MacBook Airs now...
With yesterday’s release of 15-inch M3 MacBook Airs with 16GB of RAM standard, Apple has dropped prices on clearance Certified Refurbished 15″ 8GB M3 MacBook Airs to a new low starting at only $999.... Read more
Apple has clearance 15-inch M2 MacBook Airs a...
Apple has clearance, Certified Refurbished, 15″ M2 MacBook Airs now available starting at $929 and ranging up to $410 off original MSRP. These are the cheapest 15″ MacBook Airs for sale today at... Read more
Apple drops prices on 13-inch M2 MacBook Airs...
Apple has dropped prices on 13″ M2 MacBook Airs to a new low of only $749 in their Certified Refurbished store. These are the cheapest M2-powered MacBooks for sale at Apple. Apple’s one-year warranty... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, now available for $679 for 8-Core CPU/7-Core GPU/256GB models. Apple’s one-year warranty is included, shipping is free, and each... Read more

Jobs Board

Seasonal Cashier - *Apple* Blossom Mall - J...
Seasonal Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Seasonal Fine Jewelry Commission Associate -...
…Fine Jewelry Commission Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) Read more
Seasonal Operations Associate - *Apple* Blo...
Seasonal Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Read more
Hair Stylist - *Apple* Blossom Mall - JCPen...
Hair Stylist - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.