Objective-C只用于Mac OS/iPhone的开发吗?

时间:2021-10-14 12:26:25

I don't know Objective-C but to me it appears a nice language. But the only context I know it from is everything Apple. But Objective-C is even in the GNU Compiler Collection.

我不知道Objective-C,但对我来说这是一门很好的语言。但我所知道的唯一背景是苹果的一切。但是Objective-C甚至在GNU编译器集合中。

Is there something missing in the open ones? Or is there already a broader base for Objective-C? I'm interested if there are companies that chose Objective-C to develop their products.

开放的那些有什么缺失吗?或者Objective-C已经有更广泛的基础了吗?如果有公司选择Objective-C来开发他们的产品,我很感兴趣。

7 个解决方案

#1


36  

I think ObjC has been isolated to the Apple world through a quirk of history and the nature of proprietary systems.

我认为ObjC由于历史的巧合和私有系统的特性已经被苹果世界孤立了。

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.

首先,需要将ObjC和Cocoa分离开来。ObjC是一种非常原始的语言。我认为这是一种非常优雅的语言,但它是极其基本的。您可以在C预处理器中实现ObjCv1。c++和ObjC是在同一时间开发的。c++提供了大量的基础设施,将类似C的语法引入到一种完全不同的语言中。ObjC给C带来了一个类似于smalltalk的语法,几乎没有其他内容。甚至连+alloc和-release这样的东西都不是ObjC的语言元素。它们是围绕malloc()和free()的相当简单的包装器。站在独立的地方,ObjC并不是那么有趣(我认为它很优雅)。这与Smalltalk的本质非常相似。如果没有对象库,您就无法使用它。它的对象库非常强大。

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.

接下来在ObjC上提供了整个框架叫做NeXTSTEP。因为下一台计算机并不是大范围的商业成功,NeXTSTEP是专有的,没有多少人了解框架或底层语言。当苹果买了它,并把它变成了可可,它仍然是一个私有系统。

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.

GNUStep就在那里,但是他们从来没有开发出任何有趣的东西来吸引大量的开发人员(主要的web浏览器或文字处理器等)。在过去的几年里,可可已经远远领先于GNUStep。随着人们对Cocoa的兴趣由于iPhone的崛起,GNUStep可能会重新焕发活力,带来一个不错的跨平台开发框架,但我有点怀疑。有c++背景的人可以查看c#并看到明显的改进。当他们看ObjC的时候,他们会看到很多方括号,这是他们不希望看到的。对于在“调用方法”范式中长大的人来说,“传递消息”的Smalltalk范式是陌生的,甚至有点吓人。许多开发人员认为,他们需要一种强类型语言来避免bug,并且对主要依赖程序员规程和谨慎一致性的系统感到不舒服。在c#中“只工作”的东西比在ObjC中要容易得多。ObjC期望更多的开发人员了解正在发生的事情,而不是依赖编译器保护您不受攻击。

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.

基本上,人们从Unix中了解了C, c++在C方面有意义,Java在c++方面有意义,c#刚刚清除了Java。ObjC不是这些。这是Smalltalk,没有人再学Smalltalk了。

* 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.

*最近我和写+alloc的人聊天,他可能会反对我把它叫做一个简单的包装,因为它包含了一些区域。如果你知道它们的区别,用+new替换+alloc。

#2


16  

Well, there is also the GNUStep framework that some people still develop for. I don't know how active that community is, however.

还有GNUStep框架一些人还在开发。然而,我不知道这个社区有多活跃。

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.

但在大多数情况下,Objective-C现在是一种苹果语言,这一点可以从“2.0”版本的语言作为OSX 10.5的一部分发布来说明,而且似乎是苹果公司内部的开发工作。

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.

编辑:您可能知道,苹果有一个叫做Cocoa框架,它基本上是指Objective-C的整个库堆栈,包括NSObject公共基类。Cocoa是NextStep库的延续,它是开源版本的GNUStep。因此,您可以在这两个地方找到许多带有ns前缀的类,但是Apple并没有在添加新类或在Cocoa中更改它们方面有所保留,因此GUI级别的互操作性实际上只是一种理论上的可能性。

#3


10  

@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.

@Stephen:我一直很惊讶,为什么人们从来不看我们的网站,甚至在说出这样的话之前都不查看项目进展。:) GNUstep紧跟Cocoa,现在我们远远不止是OpenStep。如果你,或者其他人,想对这个话题有一个真实的看法,从SVN获得GNUstep,安装它并尝试它。对一些你不知道的事情(如你在这里的回答所示)进行思考是没有意义的。

Greg C. GNUstep Lead Developer

Greg C. GNUstep领导开发人员

#4


6  

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...)

GNUstep实际上比大多数人认为的要活跃得多,并且非常值得关注。创建适用于GNUstep和Cocoa的应用程序并不难(这意味着可能适用于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://www.gnu.org/software/gnustep/information/aboutGNUstep.html

http://etoileos.com/news/

http://etoileos.com/news/

http://www.nongnu.org/gap/

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":

然后是Cocotron,一个“开源项目,旨在实现一个跨平台的Objective-C API,类似于苹果公司的Cocoa文档所描述的那样”:

http://www.cocotron.org/

http://www.cocotron.org/

EDIT: For an example of a commercial cross-platform product built with GNUstep, check out Eggplant.

编辑:关于一个用GNUstep构建的商业跨平台产品的例子,请查看茄子。

#5


4  

GNUstep. There is also Étoilé which is an OS built with GNUstep.

GNUstep。还有Etoile,它是一个用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.

我认为很多人更喜欢C或c++,如果他们想要更现代的语言,他们会使用c#或Java。

#6


1  

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!

我认为,苹果的实现只是得到了更好的支持,而且仍在积极开发中。还有其他一些地方,比如GNUStep,但是它们看起来仍然非常接近于NextStep/OpenStep。不幸的是,从那以后发生了很多事情!

#7


0  

The Mono team are doing something with iPhone development which allows iPhone apps to be writting in .NET and cross-compiled with the Mono .NET compiler(s). Check it out at http://www.mono-project.com/Mono:Iphone

Mono团队正在为iPhone开发做一些工作,该开发允许iPhone应用程序在。net中编写,并与Mono . net编译器交叉编译。请查看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.

最新的。net Rocks播客有Rory Blythe谈论他在objective C和iPhone开发中所做的事情。

#1


36  

I think ObjC has been isolated to the Apple world through a quirk of history and the nature of proprietary systems.

我认为ObjC由于历史的巧合和私有系统的特性已经被苹果世界孤立了。

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.

首先,需要将ObjC和Cocoa分离开来。ObjC是一种非常原始的语言。我认为这是一种非常优雅的语言,但它是极其基本的。您可以在C预处理器中实现ObjCv1。c++和ObjC是在同一时间开发的。c++提供了大量的基础设施,将类似C的语法引入到一种完全不同的语言中。ObjC给C带来了一个类似于smalltalk的语法,几乎没有其他内容。甚至连+alloc和-release这样的东西都不是ObjC的语言元素。它们是围绕malloc()和free()的相当简单的包装器。站在独立的地方,ObjC并不是那么有趣(我认为它很优雅)。这与Smalltalk的本质非常相似。如果没有对象库,您就无法使用它。它的对象库非常强大。

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.

接下来在ObjC上提供了整个框架叫做NeXTSTEP。因为下一台计算机并不是大范围的商业成功,NeXTSTEP是专有的,没有多少人了解框架或底层语言。当苹果买了它,并把它变成了可可,它仍然是一个私有系统。

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.

GNUStep就在那里,但是他们从来没有开发出任何有趣的东西来吸引大量的开发人员(主要的web浏览器或文字处理器等)。在过去的几年里,可可已经远远领先于GNUStep。随着人们对Cocoa的兴趣由于iPhone的崛起,GNUStep可能会重新焕发活力,带来一个不错的跨平台开发框架,但我有点怀疑。有c++背景的人可以查看c#并看到明显的改进。当他们看ObjC的时候,他们会看到很多方括号,这是他们不希望看到的。对于在“调用方法”范式中长大的人来说,“传递消息”的Smalltalk范式是陌生的,甚至有点吓人。许多开发人员认为,他们需要一种强类型语言来避免bug,并且对主要依赖程序员规程和谨慎一致性的系统感到不舒服。在c#中“只工作”的东西比在ObjC中要容易得多。ObjC期望更多的开发人员了解正在发生的事情,而不是依赖编译器保护您不受攻击。

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.

基本上,人们从Unix中了解了C, c++在C方面有意义,Java在c++方面有意义,c#刚刚清除了Java。ObjC不是这些。这是Smalltalk,没有人再学Smalltalk了。

* 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.

*最近我和写+alloc的人聊天,他可能会反对我把它叫做一个简单的包装,因为它包含了一些区域。如果你知道它们的区别,用+new替换+alloc。

#2


16  

Well, there is also the GNUStep framework that some people still develop for. I don't know how active that community is, however.

还有GNUStep框架一些人还在开发。然而,我不知道这个社区有多活跃。

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.

但在大多数情况下,Objective-C现在是一种苹果语言,这一点可以从“2.0”版本的语言作为OSX 10.5的一部分发布来说明,而且似乎是苹果公司内部的开发工作。

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.

编辑:您可能知道,苹果有一个叫做Cocoa框架,它基本上是指Objective-C的整个库堆栈,包括NSObject公共基类。Cocoa是NextStep库的延续,它是开源版本的GNUStep。因此,您可以在这两个地方找到许多带有ns前缀的类,但是Apple并没有在添加新类或在Cocoa中更改它们方面有所保留,因此GUI级别的互操作性实际上只是一种理论上的可能性。

#3


10  

@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.

@Stephen:我一直很惊讶,为什么人们从来不看我们的网站,甚至在说出这样的话之前都不查看项目进展。:) GNUstep紧跟Cocoa,现在我们远远不止是OpenStep。如果你,或者其他人,想对这个话题有一个真实的看法,从SVN获得GNUstep,安装它并尝试它。对一些你不知道的事情(如你在这里的回答所示)进行思考是没有意义的。

Greg C. GNUstep Lead Developer

Greg C. GNUstep领导开发人员

#4


6  

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...)

GNUstep实际上比大多数人认为的要活跃得多,并且非常值得关注。创建适用于GNUstep和Cocoa的应用程序并不难(这意味着可能适用于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://www.gnu.org/software/gnustep/information/aboutGNUstep.html

http://etoileos.com/news/

http://etoileos.com/news/

http://www.nongnu.org/gap/

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":

然后是Cocotron,一个“开源项目,旨在实现一个跨平台的Objective-C API,类似于苹果公司的Cocoa文档所描述的那样”:

http://www.cocotron.org/

http://www.cocotron.org/

EDIT: For an example of a commercial cross-platform product built with GNUstep, check out Eggplant.

编辑:关于一个用GNUstep构建的商业跨平台产品的例子,请查看茄子。

#5


4  

GNUstep. There is also Étoilé which is an OS built with GNUstep.

GNUstep。还有Etoile,它是一个用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.

我认为很多人更喜欢C或c++,如果他们想要更现代的语言,他们会使用c#或Java。

#6


1  

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!

我认为,苹果的实现只是得到了更好的支持,而且仍在积极开发中。还有其他一些地方,比如GNUStep,但是它们看起来仍然非常接近于NextStep/OpenStep。不幸的是,从那以后发生了很多事情!

#7


0  

The Mono team are doing something with iPhone development which allows iPhone apps to be writting in .NET and cross-compiled with the Mono .NET compiler(s). Check it out at http://www.mono-project.com/Mono:Iphone

Mono团队正在为iPhone开发做一些工作,该开发允许iPhone应用程序在。net中编写,并与Mono . net编译器交叉编译。请查看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.

最新的。net Rocks播客有Rory Blythe谈论他在objective C和iPhone开发中所做的事情。