Chapter 7. The Objective-C Language

Objective-C is an object-oriented programming (OOP) language that forms the basis of most new 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 object-oriented programming, 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 to be 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 object-oriented language for that matter, can learn Objective-C in a few hours. For those with no understanding of object-oriented programming, 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 powerful than other languages, by way of its dynamism, as you will learn as you proceed through this chapter. Cocoa developers, extolling the virtues of the Objective-C/Cocoa combination, often claim that they ...

Get Beginning Mac OS® X Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.