posts - 167,comments - 230,trackbacks - 0



From  Apple Site: Cocoa Overview

Cocoa is an object-oriented application environment designed specifically for developing Mac OS X-only native applications and is a peer to Carbon and Java.

Cocoa consists of a suite of object-oriented software libraries and a runtime engine, and shares an integrated development environment with the other application environments. You can write Cocoa applications in either Objective-C or Objective-C++ (there are Java bindings as well) but you can also call Carbon C functions.

Cocoa provides a basic application framework for event-driven behavior and for application, window, and workspace management. The Cocoa frameworks include a complete set of classes.  The core Cocoa frameworks are Foundation and Application Kit, which contain the classes needed by applications and other tools.

The Foundation framework defines a base layer of classes that can be used for any type of Cocoa program, but are used primarily for creating applications that don't need a user interface, such as command-line tools and Internet servers.

The Application Kit framework contains all the objects you need to implement your graphical, event-driven user interface, including windows, dialogs, buttons, menus, scrollers, and text fields.

When coupled with Interface Builder(Apple's user design tool), Cocoa helps you create fully functional, object-oriented applications on Mac OS X in a fraction of the time you would need using procedural languages.

The Foundation and Application Kit frameworks and Cocoa's infrastructure takes care of the details for you, so you can concentrate on features.


Cocoa 应用程序已经逐步成为 Mac OS X 的规范。 iPhoto 是一个 Cocoa 应用程序,同样 Safari 和 Mail 也是。这些应用程序已经因为它们的聪明的设计,丰富的功能以及吸引人的用户界面得到了广泛的好评。但是对于普通用户来说他们并不能看到这些应用程序是怎样快速完成(与典型的开发周期对比)从设计阶段到最终部署版本的。那么是什么使得 Cocoa 作为一个应用程序和开发环境成为 Carbon 可行的甚至是诱人的替代呢?

了解一下Cocoa的来源还是很有意思的。


Cocoa 的演变 (A bit of the history)
各位七十年代出生的开发人员可能还对NeXT还有隐隐约约的印象,当时Steven Jobs离开了Apple开创了 Next系统公司并立志要创建完美的Unix 工作站。

Next Cube曾经是桌面上最酷的工作站,除了出色的硬件性能,Next还开发了全新的面向对象的编程环境叫做 NextStep. 这可谓是当时最好的桌面开发环境了。当然代价就是高昂的价格,六千美元的起始价让许多商业用户转向了SUN 和HP. 不过由于NeXT 在学术界的声望,不少当时最优秀的计算机人才或多或少地受到了NextStep的影响,包括后来的Java ,在设计上受到了NeXT step很大的影响。世界上第一台web server就是运行在NeXT的工作站上。

由于硬件上的失败,NeXT在九十年代中期转型为专业的软件公司,专门授权他们独一无二的技术 – NeXT OS 和 NeXT Step. 并和Sun合作推广基于NeXT Step的编程环境并演化为Unix上通用的Framework叫做OpenStep. 说到这里,各位可能对Linux GNOME上那个OpenStep Desktop Theme的来源有了个大致的理解了吧 ? 

NeXT Step在当时最大的卖点有两条。一是基于最纯正的面向对象的系统,二是因为NeXT Step的跨平台特性,Objective C是动态的编程语言所以它是基于Runtime来提供Meta Data (列如 selector, class information等等)。听起来是不是很熟耳(Java?), 可以说NeXTStep 是java出现前最出色的开发环境。至今还有很多基于NeXTStep的项目还在开发中。

到了1996年世界发生了转折,Internet的盛起,Java的流行,Apple的衰败,Microsoft的独裁。整个业界不得不面临一个全新的格局。Apple当时已经有了一个用来对付windows 95的全新操作系统CopLand, 它因为没能及时赶上技术的需求不得不面对流产的危险。Apple需要一个能够跟的上时代的操作系统, NeXT和Apple的合并挽救了这个即将破产的公司。Apple获得了两贴回春药  Steven Jobs 和 NeXT Step.

NeXT 的到来改写了Apple的整个软件策略,一种基于NeXT Step的操作系统成为了Apple下一个二十年的基础。与此同时硬件方面的iMac和软件方面的OS8为apple争取了三年时间直到Rhapsody(Mac OS X)的诞生。(如果大家对这段Yellow Box, Blue Box 和Rhapsody的历史感兴趣可以写信给我另行探讨)

COCOA就是NextStep. 它是用Objective-C编写的一种开发环境,它包含了Application Kit和Foundation两个部分。Foundation包括了基本的数据类型的定义,数据集合框架(Data Collection Framework),辅助类(Utility Classes) 和网络及IO框架。Application Kit主要用于开发GUI。如果你是unix的开发人员,你可以用标准的POSIX API或Cocoa Foundation来开发。

http://blog.uniqpod.com/archives/i_mac/index.html


更多的Cocoa在Apple Site  http://developer.apple.com.cn/Documentation/CocoaOverview/index.html

Cocoa and JAVA  http://blog.uniqpod.com/archives/i_mac/index.html

posted on 2005-06-16 00:03 Think Different 阅读(142) 评论(0)  编辑  收藏 所属分类: Apple