Issue: 1.1 (August/September 2002)
Author: Colin Cornaby
Author Bio: Colin Cornaby is an OS X developer. Current projects include "Duality," a theme changer for Mac OS X, written in REALbasic.
Article Description: Cocoa background
Article Length (in bytes): 4,815
Starting Page Number: 43
Article Number: 1014
Related Link(s): None
Excerpt of article text...
When Apple released Mac OS X in March last year they did something remarkable. Included with the operating system (or available for a free download) were powerful development tools that rival the costly commercial C++ development tools of other platforms. This opened many new possibilities not only for companies wanting to port existing code to OS X, but also for shareware and freeware developers, and hobbyists. Now, amateurs and smaller developers could try programming without paying for development tools. Not only that, but Cocoa is one of the easiest varieties of C. It is a powerful Mac OS X-only language that allows programmers to use advanced portions of OS X.
In this column I'll be exploring Cocoa from a REALbasic developer's standpoint. I will also highlight the main differences between Cocoa and REALBasic. I'll be assuming that you are an intermediate RB programmer, and you know the basic vocabulary of RB (such as a method, a class, an argument, etc). I believe that having a firm understanding of RB is important before trying Cocoa, as RB and Cocoa are built on similar concepts. I'll assume, however, that you know nothing about Cocoa, Mac OS X, or C.
You might get the feeling from my introduction that Apple invented Cocoa recently. In fact, they didn't. Cocoa is probably about as old as that LC II most of us have wasting away somewhere. When Steve Jobs was exiled from Apple back in the 80's he took some of his engineers and founded NeXT, a company dedicated to creating powerful new technology. They built futuristic machines called NeXT Cubes and a new operating system called NeXTStep, which shared the Cube's spiffy technology. It was based on UNIX and was a wonder of its time. NeXT Cubes were powered by a new variation of C++, which was "object oriented." Objects can send and receive messages as you've probably found in REALBasic. NeXT's new variation of C++ made programming a lot easier. NeXT programmers quickly and easily built interfaces, cutting development time down to a fraction of what it had been. This new language became known as Object-Oriented C.
Unfortunately, the NeXT cubes faced the same fate as their more recent incarnation, the G4 Cube. Too overpriced and overpowered for the average home user, NeXT Cubes only caught on in high tech labs and businesses. NeXT cut back their hardware division and began pushing NeXTStep as an alternative OS for (ironically) x86 based PCs.
NeXT continued with software development and became fairly popular with developers for its advanced programming language, but still never caught on in a market that was built for Windows. However, it was around this time that Apple was looking for a new OS. Apple needed a product that would compete with Microsoft's new Windows NT OS and saw NeXTStep as exactly what it needed. Apple bought NeXT and began the process of bringing the code over to the Mac. Apple began to experiment with NeXT's programming language (now dubbed Cocoa). They actually ported Cocoa so it could run in Windows along with other Windows applications.
Apple also developed Carbon. Carbon was simply a version of OS 9's libraries that ran under Mac OS X. Because Cocoa was so different from other programming languages on the Mac, Apple realized that developers could not easily port their code from OS 9. Carbon is the version of C++ that developers use to port projects from "Classic" Mac OS to Mac OS X. Many developers still write code in Carbon so that both OS 9 and OS X users can run their programs (especially games). REALbasic and programs compiled in REALbasic are also Carbon.
...End of Excerpt. Please purchase the magazine to read the full article.