本文介绍了Objective-C仅用于Mac OS/iPhone上的开发吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不了解Objective-C,但对我来说,它似乎是一种不错的语言.但是,我所知道的唯一背景是苹果公司的一切.但是Objective-C甚至在GNU编译器集合中.

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来开发产品的公司感兴趣.

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.

推荐答案

我认为ObjC已通过对历史和专有系统性质的怪异而与苹果世界隔离了.

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

首先,您需要将ObjC与可可分开. ObjC是一种非常原始的语言.我认为这是一种非常优雅的语言,但它是非常基础的.您可以在C预处理器中实现ObjCv1. C ++和ObjC大约是同时开发的. C ++建立了大量的基础结构,以将类似于C的语法带入基本上是完全不同的语言中. ObjC为C带来了类似Smalltalk的语法,几乎没有别的.甚至+alloc-release之类的东西也不是ObjC的语言元素.它们是围绕malloc()free()的相当简单的包装器.单独站立,ObjC并不是那么有趣(我认为这很优雅).这与Smalltalk的性质非常相似.没有它的对象库,您将无能为力.凭借其对象库,它的功能异常强大.

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在ObjC之上提供了称为NeXTSTEP的整个框架.由于NeXT计算机在商业上并未获得广泛成功,并且NeXTSTEP是专有的,因此没有多少人了解该框架或底层语言.当苹果公司购买它并将其转变为可可时,它仍然是专有系统.

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在那里,但他们从未开发出足以吸引很多开发人员(大型Web浏览器或文字处理器等)的有趣东西.在过去的几年中,可可已经远远领先于GNUStep.随着iPhone引起的对Cocoa的兴趣增加,GNUStep可能会重新焕发活力并带来一个不错的跨平台开发框架,但我对此表示怀疑.具有C ++背景的人们可以查看C#并看到明显的改进.当他们看着ObjC时,会看到很多不希望出现的方括号.对于那些采用调用方法"范式的人来说,传递消息"的Smalltalk范式是陌生的,甚至有些吓人.许多开发人员认为他们需要一种强类型化的语言来避免错误,并且对于主要依赖程序员纪律和谨慎的一致性的系统感到不舒服.与在ObjC中相比,在C#中破解有效"的东西要容易得多. ObjC确实希望更多的开发人员了解正在发生的事情,而不是依赖编译器来保护您免受黑客攻击.

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.

基本上,人们从Unix知道C,并且C ++在C方面有意义,而Java在C ++方面有意义,而C#只是在清理Java. ObjC并不是其中的任何一个.是Smalltalk,没有人再学习Smalltalk.

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.

最近,我与写+alloc的人聊天,他可能会反对我称其为简单包装,因为其中包含了区域.因此,对于知道差异的人,请在此处将+alloc替换为+new.

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.

这篇关于Objective-C仅用于Mac OS/iPhone上的开发吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 09:54