Language Performance and Analysis In early 1980, Brad chos (Brad Cox) invented the Objective-C, it is developed on the basis of the Smalltalk-80 language. Objective-C is a new programming language for creating and manipulating objects that is created by adding extensions to the C language. In a certain extent, the Objective-C is seen as a superset of ANSI C language version. It supports the same basic C language grammar, and extends the standard ANSI C language syntax, including the definition of classes, methods and attributes. Of course, there are some other structural improvement and development, such as the emergence of categories (Category).49287
Objective-C is a very "practical" language. It is a C language written in a very small run library, so that the size of the application is very small, compared with this, most OO systems require a great run time virtual machine to perform. Written in Objective-C programs usually do not than its source code and function library (usually without contains in the software release version) too much, not like the Smalltalk system, even if it's just open a window also need to great memory. Due to the dynamic type of Objective-C features, Objective-C can not be inline (inline) a class of optimization, so that the application of Objective-C than C or C++ program is smaller.
Objective-C new naming rules application. Objective-C does not include namespace mechanisms, and the way to deal with this problem is that the programmer must prefix the class name. Because the prefix is often shorter (compared to a namespace), this often causes a conflict. Starting in 2007, in the Cocoa programming environment, all OS X Mac classes and functions have a "NS" prefix (for example, NSButton or NSObject) to clearly identify them as belonging to the OS X Mac core. The use of "NS" is due to the name of these categories is set when the NeXTSTEP development.
Objective-C unique personality. Although Objective-C is a strict superset of C, but it is not the basic type of C as first class objects. Unlike C++, Objective-C does not support operator overloading (does not support ad-hoc type). Different from C++ (but identical to Java), Objective-C only allows objects to inherit a class (no multiple inheritance). Categories and Protocols can provide a lot of multiple inheritance benefits, and there are no drawbacks, such as extra execution time is too heavy and binary incompatibility.
Due to the Objective-C using dynamic run time type, and all methods are the function call (and sometimes even system call is, a lot of common compile time performance optimization method can not be applied on the Objective-C (for example function inlining, constant propagation, interactive optimization, scalar replacement and aggregates, etc.). This makes the Objective-C performance worse than similar object abstraction languages (e.g., C++). But Objective-C advocates believe that, since the Objective-C runtime consumption is larger, Objective-C should not be applied to C++ or Java common underlying abstraction.
B.原文的翻译语言性能与分析
1980年年初,布莱德·确斯(Brad Cox)发明了Objective-C,它是基于SmallTalk-80的语言而发展起来的。Objective-C是在C语言基础上添加扩展而创造出来的能够创建和操作对象的一门新的程序设计语言。在一定程度上,可以把Objective-C看做ANSI版本C语言的一个超集,它支持相同的C语言基本语法,同时扩展了标准ANSI C语言的语法,包括定义类、方法和属性。当然还有其他一些结构的完善和拓展,例如类别(Category)的出现。
Objective-C是非常“实际”的语言。它是一个用C语言写成的很小的运行库,使得应用程序的大小增加很少,与此相比,大部分OO系统需要极大的运行时虚拟机来执行。用Objective-C写成的程序通常不会比其源代码和函式库(通常无须包含在软件发行版本中)大太多,不会像Smalltalk系统,即使只是打开一个窗口也需要极大的内存。由于Objective-C的动态类型特征,Objective-C不能对方法进行内联(inline)一类的优化,使得Objective-C的应用程序比C或C++程序更小。