posted by Jared White on Thu 24th Apr 2003 17:49 UTC
IconThere are two major varieties of Cocoa available. The first variety, possibly the more well known of the two, is the kind that you can use to make a nice warm cup of chocolate milk. While tasty, it's hardly proper subject matter for an operating systems information site. The second variety is far more on-topic: a programming environment for Apple Mac OS X that is the modern evolution of of the original NeXTSTEP frameworks. That's what I'm here to talk about today.

Before I go on, let me give you a brief background of my programming experience. Up until I really started using Cocoa, I was what you could call a bona fide dabbler. I dabbled in Basic for a long time, starting with Microsoft's Basic interpreter for the Commodore 64, graduating to GWBasic and QBasic in MS-DOS, and ending up using Visual Basic under Windows. I dabbled in C for a while, but didn't get too far because, frankly, I wanted to create cool little Windows productivity apps and, for that purpose, C, or even C++ at that time (mid-90's), was a major headache for a simple programming hobbyist like myself. After a while, I dropped out of programming altogether, focusing instead on Web graphics and HTML development (as well as electronic music, but that's a whole other story).

What brought me back into application development was my Web design business. I tried hard for a long time to ignore the inevitable: I couldn't rely on building Web sites using static HTML files alone for much longer. The Web was just becoming too big and too sophisticated, and large sites were taking too long to create. So I started looking into Perl. It was easy enough to take existing, open-source Perl packages and mess around with them, but it didn't take long for me to discover that it wasn't what I was looking for. Then I found out about PHP, and I was thrilled. Now here was a language I could get behind, because it was super-easy to embed some bits of code into HTML files and include other bits of code and HTML into those files dynamically. So I really jumped onto the PHP bandwagon, and since then I've heavily customized several open-source content management systems as well as developed a simple online ordering system for my Celtic band web site.

Which brings me up to the turning point in my programming escapades. Around the time I started working with Perl and PHP, I bought my first Mac, a PowerBook G4. This was two years ago, right after the first version (10.0) of Mac OS X was released. I loved Mac OS X instantly, and I became a PC "switcher" before it was the cool thing to do. While exploring the innards of this strange new UNIX-based Mac OS, I discovered Cocoa. I was long been wishing that I could get back into real end-user desktop application development, but I didn't want to use a "simple" environment such as RealBasic (the Mac's answer to Visual Basic). Plus, I had grown quite fond of the C-style syntax of Perl and PHP. Reading up on Cocoa, I found out that it was an object-oriented framework with a clean and elegant design built using the Objective-C language, and that it had been the official development environment for the NeXTSTEP OS which Apple had purchased back in 1997. Bottom line: it was solid and robust and had been worked on for many years. It had proven itself as a viable method of rapid, modular application development, and Apple had deemed it worthy enough to make it the de-facto standard for next-generation development on the Mac. So I decided to bite the bullet and learn how to program in Cocoa, and thanks to Apple's brilliant move of bundling best-of-breed development tools with the OS for free, I could build my own apps without having to pay a single cent.

Which brings us to the present day. Now you can see where I'm coming from as a programmer: someone with a decent amount of experience in lightweight RAD languages and Web scripting languages. Most Cocoa programming guides expect you to be an expert in C or C++ programming, which I most certainly am not, so it took me much longer to wrap my head around some of the more difficult language constructs of Objective-C than it might someone else. Now that I feel that I'm at least at a knowledgeable intermediate level with Cocoa, I want to present some of the basic concepts of the environment to other people interested in Mac OS X programming (or Linux/BSD if you use the open-source clone of Cocoa called GNUStep) in a way that makes it easier to understand for "newbies" and people with experience in only simple scripting languages. However, I'm assuming that you have at least some very basic knowledge of programming concepts such as variables, data types, functions/subroutines, statements, etc., since discussion of those topics is beyond the scope of this article.

Table of contents
  1. "Cocoa 101, Part 1, Page 1"
  2. "Cocoa 101, Part 1, Page 2"
  3. "Cocoa 101, Part 1, Page 3"
  4. "Cocoa 101, Part 1, Page 4"
e p (0)    56 Comment(s)

Technology White Papers

See More