By: Aaron Hillegass Viewed: 169 times Printer Friendly Format
The story of Cocoa starts with a delightful bit of history. Once upon a time, two guys named Steve started a company called Apple Computer in their garage. The company grew rapidly, so they hired an experienced executive named John Sculley to be its CEO. After a few conflicts, John Sculley moved Steve Jobs to a position in which he had no control over the company at all. Steve Jobs left to form another computer company, called NeXT Computer.
NeXT hired a small team of brilliant engineers. This small team developed a computer, an operating system, a printer, a factory, and a set of development tools. Each piece was years ahead of competing technologies, and the masses were excited and amazed. Unfortunately, the excited masses did not buy either the computer or the printer. In 1993, the factory was closed, and NeXT Computer, Inc., became NeXT Software, Inc.
The operating system and the development tools continued to sell under the name NeXTSTEP. Although the average computer user had never heard of NeXTSTEP, it was very popular with scientists, investment banks, and intelligence agencies. These were people who developed new applications every week, and they found that NeXTSTEP enabled them to implement their ideas more quickly than any other technology did.
What was this operating system? NeXT decided to use Unix as the core of NeXTSTEP, relying on the source code for BSD Unix from the University of California at Berkeley. Why Unix? Unix crashed much less frequently than Microsoft Windows or Mac OS and came with powerful, reliable networking capabilities.
Apple has made the source code to the Unix part of Mac OS X available under the name Darwin. A community of developers continues to work to improve Darwin. You can learn more about Darwin at http://macosforge.org/.
NeXT then wrote a window server for the operating system. A window server takes events from the user and forwards them to the applications. The application then sends drawing commands back to the window server to update what the user sees. One of the nifty things about the NeXT window server is that the drawing code that goes to the window server is the same drawing code that would be sent to the printer. Thus, a programmer has to write the drawing code only once, and it can then be used for display on the screen or printing. In the NeXTSTEP days, programmers were writing code that generated PostScript. With Mac OS X, programmers are writing code that uses the CoreGraphics framework (also known as Quartz). Quartz can composite those graphics onto the screen, send them to the printer, or generate PDF data. The Portable Document Format is an open standard created by the Adobe Corporation for vector graphics.
If you have used Unix machines before, you are probably familiar with the X window server. The window server for Mac OS X is completely different but fulfills the same function as the X window server: It gets events from the user, forwards them to the applications, and puts data from the applications onto the screen. At the moment, the X protocol has poor support for antialiased fonts and transparency. This is one of the reasons that the Mac OS X window server looks so much better than an X window server.
NeXTSTEP came with a set of libraries and tools to enable programmers to deal with the window manager in an elegant manner. The libraries were called frameworks. In 1993, the frameworks and tools were revised and renamed OpenStep, which was itself later renamed Cocoa.
As shown in Figure 1.1, the window server and your application are Unix processes. Cocoa enables your application to receive events from the window server and to draw to the screen.
Programming with the frameworks is done in a language called Objective-C. Like C++, Objective-C is an extension to the C programming language, making it object oriented. Unlike C++, Objective-C is weakly typed and extremely powerful. With power comes responsibility: Objective-C allows programmers to make ridiculous errors. Objective-C is a very simple addition to C, and you will find it very easy to learn.
Programmers loved OpenStep. It enabled them to experiment more easily with new ideas. In fact, Tim Berners-Lee developed the first Web browser and the first Web server on NeXTSTEP. Securities analysts could code and test new financial models much more quickly. Colleges could develop the applications that made their research possible. I don't know what the intelligence community was using it for, but intelligence agencies bought thousands of copies of OpenStep. Because they were so useful, the OpenStep development tools were ported to Solaris and Windows NT, and the NeXTSTEP operating system was ported to most of the popular CPUs of the day: Intel, Motorola, Hewlett-Packard's PA-RISC, and SPARC. (Oddly enough, OpenStep didn't run on a Mac until the first version of Mac OS X Server, known as Rhapsody, shipped in 1999.)
For many years, Apple Computer had been working to develop an operating system with many of the features of NeXTSTEP. This effort was known as Copland. Project Copland gradually spun out of control, and Apple finally decided to pull the plug and buy the next version of Mac OS from another company. After surveying the existing operating systems, Apple selected NeXTSTEP. Because NeXT was small, Apple simply bought the whole company in December 1996.
Where do I fit into this story? I was writing code for NeXT computers on Wall Street until NeXT hired me to teach OpenStep programming to other developers. I was an employee at NeXT when it merged with Apple, and I taught many of the Apple engineers how to write applications for Mac OS X. No longer an Apple employee, I now teach Cocoa programming for Big Nerd Ranch, Inc.
NeXTSTEP became Mac OS X. It is Unix underneath, and you can get all the standard Unix programs, such as the Apache Web server, on Mac OS X, which is more stable than Windows and Mac OS 9. The user interface is spectacular. You, the developer, are going to love Mac OS X because Cocoa will enable you to write full-featured applications in a radically more efficient and elegant manner.
Most Viewed Articles (in Cocoa )
Latest Articles (in Cocoa)
Comment on this tutorial
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews
Subscribe to Tutorials
1. I'm trying to follow this backward, but I can't fi
View Tutorial By: DMM at 2014-03-14 21:42:06