I think ObjC has been isolated to the Apple world through a quirk of history and the nature of proprietary systems.
First, you need to separate ObjC from Cocoa. ObjC is a very primitive language. I think it is a very elegant language, but it is extremely basic. You can implement ObjCv1 in a C pre-processor. C++ and ObjC were developed about the same time. C++ put a huge amount of infrastructure in place to bring a C-like syntax to what is basically a completely different language. ObjC brought a Smalltalk-like syntax to C, with almost nothing else. Even things like +alloc and -release aren't language elements of ObjC. They're fairly simple wrappers around malloc() and free().* Standing on its own, ObjC isn't really that interesting (elegant as I think it is). This is very similar to the nature of Smalltalk. Without its object libraries, there isn't much you can do with it. With its object libraries, it's incredibly powerful.
NeXT provided this entire framework on top of ObjC called NeXTSTEP. Since the NeXT computer was not a widespread commercial success, and NeXTSTEP was proprietary, not many people learned the framework or the underlying language. When Apple bought it, and morphed it into Cocoa, it continued to be a proprietary system.
GNUStep is out there, but they never developed anything interesting enough to bring in a lot of developers (a major web browser or word processor or the like). And Cocoa has gotten well ahead of GNUStep over the last few years. It's possible that with the rise of interest in Cocoa due to iPhone, that GNUStep may revitalize and bring a nice cross-platform development framework, but I kind of doubt it. Folks who have a background in C++ look at C# and see a clear improvement. When they look at ObjC, they see a lot of square brackets where they don't expect them. For people raised on the "calling methods" paradigm, the Smalltalk paradigm of "passing messages" is alien and even a bit scary. Many developers assume they need a strongly typed language to avoid bugs and are uncomfortable with a system that relies primarily on programmer discipline and careful consistency. It is much easier to hack something that "just works" in C# than in ObjC. ObjC really expects a lot more of the developer in understanding what's going on and not relying on the compiler to protect you from your hacks.
Basically, folks knew C from Unix, and C++ makes sense in terms of C, and Java makes sense in terms of C++, and C# is just cleaned up Java. ObjC isn't any of these. It's Smalltalk, and no one learns Smalltalk anymore.
* I recently chatted with the guy who wrote +alloc about its history, and he might object to my calling it a simple wrapper given the inclusion of zones. So for you who know the difference, replace +alloc here with +new.
Well, there is also the GNUStep framework that some people still develop for. I don't know how active that community is, however.
But for the most part Objective-C is now an Apple language, as illustrated by the fact that the "2.0" version of the language was launched as part of OSX 10.5 and seems to have been a purely in-house development effort at Apple.
Edit: Apple, as you probably know, has something called the Cocoa framework, which basically refers to the entire stack of libraries for Objective-C, including the NSObject common baseclass. Cocoa is a continuation of the NextStep library, which GNUStep is the open-source version of. So you'll find many of the NS-prefixed classes both places, but Apple has not held back in adding new classes or changing them in Cocoa, so interoperability at the GUI level is really only a theoretical possibility.
@Stephen: I'm constantly surprised at how people never read our website or even check on the progress of the project before saying things like this. :) GNUstep follows Cocoa closely now and we're so much more than OpenStep at this point. If you, or others, want to have a real opinion on the subject get GNUstep from SVN, install it and try it out. Pontification about something you know nothing about (as demonstrated by your response here) is pointless.
GNUstep is actually much more active than most people think it is, and very worth keeping an eye on. It's not hard to create apps that work across GNUstep and Cocoa (meaning potentially on OSX, Win, Linux, BSD...)
These links are definitely worth checking out for anyone interested in the topic:
Then there is Cocotron, an "open source project which aims to implement a cross-platform Objective-C API similar to that described by Apple Inc.'s Cocoa documentation":
我认为 Apple 的实现得到了更好的支持,并且仍在积极开发中。 还有一些其他地方,例如 GNUStep,但它们看起来仍然非常处于 NextStep/OpenStep 级别。 不幸的是,从那时起发生了很多事情!
I think the Apple implementation is just better supported and still in active development. There are some other places, such as GNUStep, but they still look to be very much at the NextStep/OpenStep level. Unfortunately a lot has happened since then!
The Mono team are doing something with iPhone development which allows iPhone apps to be written in .NET and cross-compiled with the Mono .NET compiler(s). Check it out at http://www.mono-project.com/Mono:Iphone
The latest .NET Rocks podcast has Rory Blythe talking about stuff he's been doing in objective C and iPhone development.
发布评论
评论(7)
我认为 ObjC 由于历史的怪异和专有系统的性质而与苹果世界隔离。
首先,您需要将 ObjC 与 Cocoa 分开。 ObjC 是一种非常原始的语言。 我认为这是一种非常优雅的语言,但它非常基础。 您可以在 C 预处理器中实现 ObjCv1。 C++ 和 ObjC 大约是在同一时间开发的。 C++ 建立了大量的基础设施,将类似 C 的语法引入到基本上完全不同的语言中。 ObjC 为 C 语言带来了类似 Smalltalk 的语法,几乎没有其他任何东西。 甚至像
+alloc
和-release
这样的东西也不是 ObjC 的语言元素。 它们是malloc()
和free()
的相当简单的包装器。* 就其本身而言,ObjC 并不是那么有趣(正如我所认为的那样优雅)。 这与Smalltalk的本质非常相似。 如果没有它的对象库,你就不能用它做太多事情。 凭借其对象库,它的功能非常强大。NeXT 在 ObjC 之上提供了整个框架,称为 NeXTSTEP。 由于 NeXT 计算机并未取得广泛的商业成功,而且 NeXTSTEP 是专有的,因此没有多少人学习该框架或底层语言。 当苹果公司收购它并将其转变为 Cocoa 时,它仍然是一个专有系统。
GNUStep 就在那里,但他们从未开发出任何足够有趣的东西来吸引大量开发人员(主要的网络浏览器或文字处理器等)。 在过去的几年里,Cocoa 已经远远领先于 GNUStep。 随着 iPhone 对 Cocoa 兴趣的增加,GNUStep 可能会重新焕发活力并带来一个不错的跨平台开发框架,但我对此表示怀疑。 具有 C++ 背景的人在查看 C# 时会看到明显的改进。 当他们查看 ObjC 时,他们会看到很多他们没有想到的方括号。 对于在“调用方法”范式中长大的人来说,Smalltalk 的“传递消息”范式是陌生的,甚至有点可怕。 许多开发人员认为他们需要一种强类型语言来避免错误,并且对主要依赖于程序员纪律和仔细一致性的系统感到不舒服。 在 C# 中破解“正常工作”的东西比在 ObjC 中容易得多。 ObjC 确实希望开发人员能够更多地了解正在发生的事情,而不是依赖编译器来保护您免受黑客攻击。
基本上,人们从 Unix 就知道了 C,C++ 在 C 方面有意义,Java 在 C++ 方面有意义,而 C# 只是清理了 Java。 ObjC 不是其中任何一个。 这是 Smalltalk,而且已经没有人学习 Smalltalk 了。
* 我最近与编写
+alloc
的人讨论了它的历史,考虑到包含区域,他可能会反对我将其称为简单的包装器。 因此,如果您知道其中的区别,请将此处的+alloc
替换为+new
。I think ObjC has been isolated to the Apple world through a quirk of history and the nature of proprietary systems.
First, you need to separate ObjC from Cocoa. ObjC is a very primitive language. I think it is a very elegant language, but it is extremely basic. You can implement ObjCv1 in a C pre-processor. C++ and ObjC were developed about the same time. C++ put a huge amount of infrastructure in place to bring a C-like syntax to what is basically a completely different language. ObjC brought a Smalltalk-like syntax to C, with almost nothing else. Even things like
+alloc
and-release
aren't language elements of ObjC. They're fairly simple wrappers aroundmalloc()
andfree()
.* Standing on its own, ObjC isn't really that interesting (elegant as I think it is). This is very similar to the nature of Smalltalk. Without its object libraries, there isn't much you can do with it. With its object libraries, it's incredibly powerful.NeXT provided this entire framework on top of ObjC called NeXTSTEP. Since the NeXT computer was not a widespread commercial success, and NeXTSTEP was proprietary, not many people learned the framework or the underlying language. When Apple bought it, and morphed it into Cocoa, it continued to be a proprietary system.
GNUStep is out there, but they never developed anything interesting enough to bring in a lot of developers (a major web browser or word processor or the like). And Cocoa has gotten well ahead of GNUStep over the last few years. It's possible that with the rise of interest in Cocoa due to iPhone, that GNUStep may revitalize and bring a nice cross-platform development framework, but I kind of doubt it. Folks who have a background in C++ look at C# and see a clear improvement. When they look at ObjC, they see a lot of square brackets where they don't expect them. For people raised on the "calling methods" paradigm, the Smalltalk paradigm of "passing messages" is alien and even a bit scary. Many developers assume they need a strongly typed language to avoid bugs and are uncomfortable with a system that relies primarily on programmer discipline and careful consistency. It is much easier to hack something that "just works" in C# than in ObjC. ObjC really expects a lot more of the developer in understanding what's going on and not relying on the compiler to protect you from your hacks.
Basically, folks knew C from Unix, and C++ makes sense in terms of C, and Java makes sense in terms of C++, and C# is just cleaned up Java. ObjC isn't any of these. It's Smalltalk, and no one learns Smalltalk anymore.
* I recently chatted with the guy who wrote
+alloc
about its history, and he might object to my calling it a simple wrapper given the inclusion of zones. So for you who know the difference, replace+alloc
here with+new
.嗯,还有一些人仍在开发的 GNUStep 框架。 不过,我不知道该社区有多活跃。
但在很大程度上,Objective-C 现在是一种 Apple 语言,该语言的“2.0”版本是作为 OSX 10.5 的一部分推出的,并且似乎纯粹是 Apple 内部的开发工作,这一事实说明了这一点。
编辑:您可能知道,Apple 有一个称为 Cocoa 框架的东西,它基本上指的是 Objective-C 的整个库堆栈,包括 NSObject 公共基类。 Cocoa 是 NextStep 库的延续,GNUStep 是其开源版本。 所以你会在这两个地方找到许多以 NS 为前缀的类,但 Apple 并没有阻止在 Cocoa 中添加新类或更改它们,因此 GUI 级别的互操作性实际上只是一种理论上的可能性。
Well, there is also the GNUStep framework that some people still develop for. I don't know how active that community is, however.
But for the most part Objective-C is now an Apple language, as illustrated by the fact that the "2.0" version of the language was launched as part of OSX 10.5 and seems to have been a purely in-house development effort at Apple.
Edit: Apple, as you probably know, has something called the Cocoa framework, which basically refers to the entire stack of libraries for Objective-C, including the NSObject common baseclass. Cocoa is a continuation of the NextStep library, which GNUStep is the open-source version of. So you'll find many of the NS-prefixed classes both places, but Apple has not held back in adding new classes or changing them in Cocoa, so interoperability at the GUI level is really only a theoretical possibility.
@Stephen:我一直感到惊讶的是,人们在说这样的话之前从来没有阅读过我们的网站,甚至没有检查过项目的进度。 :) GNUstep 现在紧随 Cocoa,在这一点上我们比 OpenStep 还要强大得多。 如果您或其他人想对这个主题有真正的看法,请从 SVN 获取 GNUstep,安装它并尝试一下。 对你一无所知的事情进行武断(正如你在这里的回应所证明的那样)是毫无意义的。
格雷格·C.
GNUstep 首席开发人员
@Stephen: I'm constantly surprised at how people never read our website or even check on the progress of the project before saying things like this. :) GNUstep follows Cocoa closely now and we're so much more than OpenStep at this point. If you, or others, want to have a real opinion on the subject get GNUstep from SVN, install it and try it out. Pontification about something you know nothing about (as demonstrated by your response here) is pointless.
Greg C.
GNUstep Lead Developer
GNUstep 实际上比大多数人想象的要活跃得多,非常值得关注。 创建跨 GNUstep 和 Cocoa 运行的应用程序并不难(意味着可能在 OSX、Win、Linux、BSD...)。
对于任何对该主题感兴趣的人来说,这些链接绝对值得查看:
http://www.gnu.org/software/gnustep/information/aboutGNUstep.html
http://etoileos.com/news/
http://www.nongnu.org/gap/
然后是 Cocotron,一个“开源项目,旨在实现类似于所描述的跨平台 Objective-C API Apple Inc. 的 Cocoa 文档”:
http://www.cocotron.org/
编辑:对于使用 GNUstep 构建的商业跨平台产品的示例,请查看 Eggplant。
GNUstep is actually much more active than most people think it is, and very worth keeping an eye on. It's not hard to create apps that work across GNUstep and Cocoa (meaning potentially on OSX, Win, Linux, BSD...)
These links are definitely worth checking out for anyone interested in the topic:
http://www.gnu.org/software/gnustep/information/aboutGNUstep.html
http://etoileos.com/news/
http://www.nongnu.org/gap/
Then there is Cocotron, an "open source project which aims to implement a cross-platform Objective-C API similar to that described by Apple Inc.'s Cocoa documentation":
http://www.cocotron.org/
EDIT: For an example of a commercial cross-platform product built with GNUstep, check out Eggplant.
GNUstep。 还有 Étoilé,它是一个用 GNUstep 构建的操作系统。
我认为很多人只是更喜欢 C 或 C++,如果他们想要更现代的语言,他们会使用 C# 或 Java。
GNUstep. There is also Étoilé which is an OS built with GNUstep.
I think many people just like C or C++ better, and if they wanted a more modern language, they would use C# or Java.
我认为 Apple 的实现得到了更好的支持,并且仍在积极开发中。 还有一些其他地方,例如 GNUStep,但它们看起来仍然非常处于 NextStep/OpenStep 级别。 不幸的是,从那时起发生了很多事情!
I think the Apple implementation is just better supported and still in active development. There are some other places, such as GNUStep, but they still look to be very much at the NextStep/OpenStep level. Unfortunately a lot has happened since then!
Mono 团队正在做一些 iPhone 开发工作,允许 iPhone 应用程序用 .NET 编写并与 Mono .NET 编译器交叉编译。 请访问 http://www.mono-project.com/Mono:Iphone
最新的.NET Rocks 播客有Rory Blythe 谈论他在 Objective C 和 iPhone 开发中所做的事情。
The Mono team are doing something with iPhone development which allows iPhone apps to be written in .NET and cross-compiled with the Mono .NET compiler(s). Check it out at http://www.mono-project.com/Mono:Iphone
The latest .NET Rocks podcast has Rory Blythe talking about stuff he's been doing in objective C and iPhone development.