Chapter 7. The Objective-C Language


  • What OOP is, and its most important characteristics

  • The extensions to C defined by the Objective-C 2.0 language, including object-oriented programming

  • How to write object-oriented programs in Objective-C, using the Foundation framework from Cocoa

Objective-C is an object-oriented programming (OOP) language that forms the basis of most software development on Mac OS X. It is a superset of the C programming language, which means that you can use C code directly in an Objective-C program. In fact, much of an Objective-C program is simply C. What's left is a small number of extensions to facilitate OOP, which can potentially make your life a lot easier as a programmer.

The philosophy of Objective-C is a minimalist one. The object-oriented (OO) features of Objective-C were designed as a compact and easy-to-understand extension to C. This is in contrast to C++, for example, which is also a superset of C, but which includes many different extensions to standard C, and is relatively difficult to learn. Anyone that understands C++, or any other OO language for that matter, can learn Objective-C in a few hours. For those with no understanding of OOP, Objective-C is one of the better languages with which to learn it, because of its simplicity.

Just because Objective-C is easy to learn and simple to use does not mean it gives away anything to other languages when it comes to expressiveness. In many ways, Objective-C is more ...

Get Beginning, Mac OS® X Snow Leopard™ Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.