Programmer's Wiki

Objective-C is a reflective object oriented programming language developed by Brad Cox as a hybrid between Smalltalk and C to combine the flexibility of Smalltalk with the execution speed of C. It was chosen by NeXT Inc. as the implementation language for the NeXTstep operating system and its API, which was later published as an open specification under the name OpenStep, After Apple Inc. acquired NeXT, Objective-C and the NextStep API became the base for Apple's current operating system Mac OS X. Today, Objective-C is the main application development language for Mac OS X.

As a hybrid of two languages with different programming paradigms, Objective-C is difficult to classify. Its core language is ANSI-C which makes it a statically typed, imperative low-level programming language. However, on top of the C core language, Objective-C defines a thin layer of Smalltalk derived object oriented features which also make it a reflective, dynamic, late binding, object oriented language. These may initially seem to be conflicting programming styles, but in practise there is a clear separation between the two. The C core language is used to code the control flow of a program and the Smalltalk derived extensions are used to define and work with abstract data types. As a result of this practise, an program written in Objective-C benefits from the expressive power and flexibility of Smalltalk and the execution speed of C.

Standards and Dialects[]

There are at present three main dialects of Objective-C.

  • NeXT/Apple's Objective-C 1.0
  • Apple's Objective-C 2.0 (a superset of v.1.0)
  • David Stes' version

Apple's Objective-C variant is the most widely used.

Objective-C Compilers[]

  • GCC front-end for Objective-C, part of the general GCC distribution
  • Clang, a new fast recursive descent compiler for C, Objective-C and C++ with an LLVM back-end, development sponsored by Apple
  • Portable Object Compiler by David Stes

Class libraries[]

It is possible to build one's own class library in Objective-C, however, in practise, most Objective-C development is done using one of a set of available class libraries, which are called frameworks in Objective-C lingo. The most common frameworks follow the OpenStep API specification:

  • Core Foundation and Cocoa, Apple's proprietary implementation of the OpenStep API specification for Mac OS X
  • Cocoa Touch, Apple's proprietary implementation of the OpenStep API for the iPhone
  • Cocotron, an open source implementation of the OpenStep API specification for Microsoft Windows
  • GNUstep, the FSF's GPL licensed implementation of the OpenStep API specification for Unix and Unix like operating systems
  • libFoundation, a BSD licensed open source implementation of the Core Foundation layer
  • WebObjects, a framework for web application development

Further reading[]