Objective-C, often signified by a shorter term ObjC, is object-oriented programming language, which is implemented as expansion of language C, to which the system adds sending messages from Smalltalk language.

Nowadays, in operating systems are being used Mac OS X, iOS and in GNU projects the GNUstep. On Openstep standard are based both environments. Objective-C is being used in application programming interface (API) Cocoa and Cocoa Touch.

Objective-C is asserted in:

  • operating systems OS X and iOS
  • applications for operating systems iOS
  • API Cocoa and Cocoa Touch

The predecessor of Swift language

Before establishing Swift, Objective-C was the main programming language for the mentioned operating systems. Part of GCC is translator to this language. However, the most used translator is clang, especially thanks to its usage in Xcode by the Apple.

Programming language Objective-C was originally developed in early 80s of 20th century, it is therefore much older than programming language Swift, which comes from Objective C in many ways and tries to modernize it.

It was chosen to be the main language used for operating systems NeXT and NextSTEP, from which the operating systems OS X and iOS developed. Portable programs in Objective-C, which does not use libraries Cocoa and Cocoa Touch, or those parts, which can be transferred or implemented to other systems, can be also compiled with the help of GNU Compiler Collection (GCC) or Clang.

Implemented Objective-C program files have the usual endpoint .m, while the header/interface files have endpoint .h, same as the header files in language C. Objective-C++ files have file name extension .mm.

Syntax specifics

Objective-C is based on sending messages to instances of objects. In Objective-C are no methods called, but they are sent. That is the difference compared to the programming model in Simula style, which uses C++. The difference between both concepts is, how is the code, on which method or message links to, initialised. In language in Simula style, is name of the method bound to the part of the code in target class of compilator.

In Smalltalk and Objective-C is the aim of the message determined during the executing, and the object, which accepts the message, interprets it itself. Method is identified by selector, which is string ending with NUL, which represents its name and is converted to indicator of C method, which it implements, i. e. IMPu. In result, it is a system of sending messages, which does not include type control. Object, to which is the message sent to, does not guarantee answer. If it does not answer, it will display an exception.

Object-oriented programming vs. programming languages In Smalltalk style

Both programming styles have their strengths and weaknesses:

Object-oriented programming in Simula style allows multiple inheritance and fast execution, when using the selection of compiling time, but standardly does not support dynamic choice. IT also forces all the methods to have the corresponding implementation, if they are not abstract.

Programming languages in Smalltalk style, as e. g. Objective-C, allow unimplemented messages, where the method is conversed to implementation during execution. Implementation is still required in case of method, which executes derived object.