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

Fresh From the Land Down Under – The Tou...
After a two week hiatus, we are back with another episode of The TouchArcade Show. Eli is fresh off his trip to Australia, which according to him is very similar to America but more upside down. Also kangaroos all over. Other topics this week... | Read more »
TouchArcade Game of the Week: ‘Dungeon T...
I’m a little conflicted on this week’s pick. Pretty much everyone knows the legend of Dungeon Raid, the match-3 RPG hybrid that took the world by storm way back in 2011. Everyone at the time was obsessed with it, but for whatever reason the... | Read more »
SwitchArcade Round-Up: Reviews Featuring...
Hello gentle readers, and welcome to the SwitchArcade Round-Up for July 19th, 2024. In today’s article, we finish up the week with the unusual appearance of a review. I’ve spent my time with Hot Lap Racing, and I’m ready to give my verdict. After... | Read more »
Draknek Interview: Alan Hazelden on Thin...
Ever since I played my first release from Draknek & Friends years ago, I knew I wanted to sit down with Alan Hazelden and chat about the team, puzzle games, and much more. | Read more »
The Latest ‘Marvel Snap’ OTA Update Buff...
I don’t know about all of you, my fellow Marvel Snap (Free) players, but these days when I see a balance update I find myself clenching my… teeth and bracing for the impact to my decks. They’ve been pretty spicy of late, after all. How will the... | Read more »
‘Honkai Star Rail’ Version 2.4 “Finest D...
HoYoverse just announced the Honkai Star Rail (Free) version 2.4 “Finest Duel Under the Pristine Blue" update alongside a surprising collaboration. Honkai Star Rail 2.4 follows the 2.3 “Farewell, Penacony" update. Read about that here. | Read more »
‘Vampire Survivors+’ on Apple Arcade Wil...
Earlier this month, Apple revealed that poncle’s excellent Vampire Survivors+ () would be heading to Apple Arcade as a new App Store Great. I reached out to poncle to check in on the DLC for Vampire Survivors+ because only the first two DLCs were... | Read more »
Homerun Clash 2: Legends Derby opens for...
Since launching in 2018, Homerun Clash has performed admirably for HAEGIN, racking up 12 million players all eager to prove they could be the next baseball champions. Well, the title will soon be up for grabs again, as Homerun Clash 2: Legends... | Read more »
‘Neverness to Everness’ Is a Free To Pla...
Perfect World Games and Hotta Studio (Tower of Fantasy) announced a new free to play open world RPG in the form of Neverness to Everness a few days ago (via Gematsu). Neverness to Everness has an urban setting, and the two reveal trailers for it... | Read more »
Meditative Puzzler ‘Ouros’ Coming to iOS...
Ouros is a mediative puzzle game from developer Michael Kamm that launched on PC just a couple of months back, and today it has been revealed that the title is now heading to iOS and Android devices next month. Which is good news I say because this... | Read more »

Price Scanner via MacPrices.net

Amazon is still selling 16-inch MacBook Pros...
Prime Day in July is over, but Amazon is still selling 16-inch Apple MacBook Pros for $500-$600 off MSRP. Shipping is free. These are the lowest prices available this weekend for new 16″ Apple... Read more
Walmart continues to sell clearance 13-inch M...
Walmart continues to offer clearance, but new, Apple 13″ M1 MacBook Airs (8GB RAM, 256GB SSD) online for $699, $300 off original MSRP, in Space Gray, Silver, and Gold colors. These are new MacBooks... Read more
Apple is offering steep discounts, up to $600...
Apple has standard-configuration 16″ M3 Max MacBook Pros available, Certified Refurbished, starting at $2969 and ranging up to $600 off MSRP. Each model features a new outer case, shipping is free,... Read more
Save up to $480 with these 14-inch M3 Pro/M3...
Apple has 14″ M3 Pro and M3 Max MacBook Pros in stock today and available, Certified Refurbished, starting at $1699 and ranging up to $480 off MSRP. Each model features a new outer case, shipping is... Read more
Amazon has clearance 9th-generation WiFi iPad...
Amazon has Apple’s 9th generation 10.2″ WiFi iPads on sale for $80-$100 off MSRP, starting only $249. Their prices are the lowest available for new iPads anywhere: – 10″ 64GB WiFi iPad (Space Gray or... Read more
Apple is offering a $50 discount on 2nd-gener...
Apple has Certified Refurbished White and Midnight HomePods available for $249, Certified Refurbished. That’s $50 off MSRP and the lowest price currently available for a full-size Apple HomePod today... Read more
The latest MacBook Pro sale at Amazon: 16-inc...
Amazon is offering instant discounts on 16″ M3 Pro and 16″ M3 Max MacBook Pros ranging up to $400 off MSRP as part of their early July 4th sale. Shipping is free. These are the lowest prices... Read more
14-inch M3 Pro MacBook Pros with 36GB of RAM...
B&H Photo has 14″ M3 Pro MacBook Pros with 36GB of RAM and 512GB or 1TB SSDs in stock today and on sale for $200 off Apple’s MSRP, each including free 1-2 day shipping: – 14″ M3 Pro MacBook Pro (... Read more
14-inch M3 MacBook Pros with 16GB of RAM on s...
B&H Photo has 14″ M3 MacBook Pros with 16GB of RAM and 512GB or 1TB SSDs in stock today and on sale for $150-$200 off Apple’s MSRP, each including free 1-2 day shipping: – 14″ M3 MacBook Pro (... Read more
Amazon is offering $170-$200 discounts on new...
Amazon is offering a $170-$200 discount on every configuration and color of Apple’s M3-powered 15″ MacBook Airs. Prices start at $1129 for models with 8GB of RAM and 256GB of storage: – 15″ M3... Read more

Jobs Board

*Apple* Systems Engineer - Chenega Corporati...
…LLC,** a **Chenega Professional Services** ' company, is looking for a ** Apple Systems Engineer** to support the Information Technology Operations and Maintenance Read more
Solutions Engineer - *Apple* - SHI (United...
**Job Summary** An Apple Solution Engineer's primary role is tosupport SHI customers in their efforts to select, deploy, and manage Apple operating systems and Read more
*Apple* / Mac Administrator - JAMF Pro - Ame...
Amentum is seeking an ** Apple / Mac Administrator - JAMF Pro** to provide support with the Apple Ecosystem to include hardware and software to join our team and Read more
Operations Associate - *Apple* Blossom Mall...
Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple 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.