A Little History
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 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.
Frameworks
A framework is a collection of classes that are intended to be used together. In other words, the classes are compiled together into a reusable library of code. Any related resources are put into a directory with the library. The directory is renamed with the extension .framework. You can find the built-in frameworks for your machine in /System/Library/Frameworks.
Cocoa is made up of three frameworks:
Numerous other frameworks handle such duties as encryption, QuickTime, and CD burning, but this book focuses on Foundation, AppKit, and Core Data because they are the most commonly used. Once you have mastered these, the other frameworks will be easier to understand.
Most of the time, Cocoa fulfills the promise: Common things are easy, and uncommon things are possible. If you find yourself writing many lines of code to do something rather ordinary, you are probably on the wrong track.
Common Mistakes
Having watched many, many people work through this material, I've seen the same mistakes made hundreds of times. I see two mistakes particularly often: capitalization mistakes and forgotten connections.
It is easy to miss some warnings the first time a file is compiled. Because Xcode does incremental compiles, you may not see those warnings again unless you clean and rebuild the project. If you are stuck, try cleaning and rebuilding.