一些装配要求

会·希普利发布一个有趣的文章,他抱怨Mac OS X的api只能使用碳他的论点的核心是真正的区别碳和可可,可可api为开发人员使事情简单多了,并且需要大量的代码行更少我认为皮普失去跟踪的要点,。

首先,他开始通过调用碳的“兼容性图书馆”“较老的应用程序”,和可可“新应用程序环境”,尽管这两个追溯到1980年代是的,原来的Mac OS工具箱api是比原来的大一点NextStep对象系统,但只有几年(In fact, it’s fair to argue that Cocoa, today in 2006, is older than Carbon was back in 2000, when the whole “Carbon is old, Cocoa is new” meme got started in earnest.) “Carbon” is humongous; it’s an umbrella label for a huge number of APIsSome of these APIs do exist for compatibility with the old Mac OS; but some of them are brand new and只有在Mac OS X上存在如果算上CoreFoundation作为碳的一部分,然后在一个非常现实的意义上它是公平地说,大多数可可坐在最高的碳甚至如果你想认为CoreFoundation坐在必要低于碳和可可,它仍然是这样可可碳HIToolbox AppKit框架使用, etc.

So the argument here shouldn’t be that Carbon is old and Cocoa is new, or that Carbon is bad and Cocoa is good; no, the argument is that Carbon is lower-level and Cocoa is higher-level, and programmers are almost always more productive, write fewer bugs, and have more fun when working with higher-level APIs.

皮普写道:

What’s distressing to Cocoa programmers is that there are still critically important Apple APIs that are only available through the incredibly byzantine and ill-documented Carbon libraries, and some groups at Apple are still generating Carbon code, under the guise of “Core”.

为例子,他引用(源代码)使用QuickTime手动控制USB摄像头,和建筑的FTP网站项目列表在用户的钥匙链。

正如皮普自己指出的那样,现在程序员可以叫碳api从可可(可可api从碳),所以这不是一个问题”你不能用可可”问题是,你不能用可可使用可可; you have to use Carbon, and compared to how it might be done if it可以使用可可,这是一个讨厌鬼。

使用可可,最好的,就像打开一个盒子,一个玩具使用碳就好像打开一个盒子,得到一把磨碎,你需要组装成一个玩具。

The whole Carbon-vs.-Cocoa propaganda thing has, thankfully, died down a bit at the user level in the last few years真的是,在大多数情况下,用户不应该担心但这绝对是一个敏感的话题对于一些Mac开发者。

丹尼尔•Jalkut上个月写的这个一篇关于调用碳从可可,反之亦然:

The saddest thing in all of Macdom is the sight of Cocoa and Carbon purists crying in their mailing list beers because a given task is “impossible” in the API of their preferenceOften a fearless API-hopper like Jim Correia or John Stiles will pop up and cheerfully announce a one-line solution to their woesIn the opposite API than the original poster had hoped, of course.

“Thanks for the response, but I’d like to keep this as pure as possible.”

对不起,我以为你想要一个解决方案You idiot! What they really mean to say is “I learned this framework 10 years ago and I’ll be damned if I have to learn anything new now.”

不过,皮普的观点并不是这样的他有一点点的抗积碳的FUD陷入他的文章,但他不是说他不想使用碳,因为他不能,或者因为他反对宗教或政治原因他说,看,这里有一些碳示例代码,它就会容易很多做这些事情如果有api在可可。

我最喜欢的一个编程的口号从拉里墙Perl,对于他的目标:“容易的事情应该很容易,困难的事情应该是可能的。”1

这当然座右铭描述可可的吸引力这就是为什么objective - c 2.0 -在WWDC 8月公布在Mac OS X 10.5——是获得垃圾收集和之类的东西foreach风格循环:他们应该很容易更简单的代码。

所以我认为皮普的观点可以概括为:使硬的东西可能是好的,但做事情容易的就更好了。


  1. 这显然是一个再形成的吗Alan Kay的“简单的事情应该是简单的,复杂的事情应该是可能的。”↩︎

前一: 全新的
下一个: BBColors 1.0