Objective-C is commonly known as the only approved development language for use in creating applications for deployment to Apple’s iPad and iPhone. At a higher level, the Objective-C language is an object-oriented that incorporates a Smalltalk-based messaging capability to ANSI C. The Objective-C language is used in the Apple Cocoa API and requires the Xcode integrated development environment (IDE) to create, build, and deploy projects.
Objective-C Language Syntax
Objective-c is a superset of the ANSI C programming language and the Apple produced compiler deployed with the Xcode IDE can compile any program written in strict ANSI C in addition to those written in Objective-C. The object syntax used in the language is based on the mechanisms defined in the Smalltalk programming language. All other programming syntax used in the language is the same as that used in ANSI C.
Objective-C Messaging
Objective-C uses an object-oriented programming model that uses the message passing found in Small talk between instances of class objects. In order to invoke a method in the language, a message is sent unlike the style of object method use in the C++ language. When the Objective-C message is sent at runtime, it is resolved to a C method and passes the message to the receiving object instance but does not perform type checking. An example of the difference in the syntax in both languages:
Objective-C Syntax:
[myObject methodName: argument1];
C++ Syntax:
myObject->methodName(argument1);
obj->method(argument);
A drawback to the methodology used in Objective-C language as compared to C++ is that it will by the nature of permitting runtime binding be slower than C++ which uses compile-time binding whenever possible. Objective-C also does not require an object be defined when the application is compiled permitting dynamic binding.
Differences Between C++ and Objective-C
A common question that arises amongst developers is understanding the differences in how C++ and Objective-C extend ANSI C. Each language takes a different approach to extending ANSI C. Objective-C does not try to add the large number of capabilities to ANSI like C++ does, instead Objective-C only works to extend the language by adding object orientated programming to existing C syntax. Objective-C also adds reflective capabilities at runtime when object instances are queried by messages. C++ on the other hand, can not do the same runtime reflective queries without the use of external libraries. C++ is also more heavily geared to relying on decisions made when programming code is compiled vice the Objective-C methodology of making runtime decisions.