Chapter 2. Object-Oriented Programming

For some Mac OS developers, the most striking adjustment they’ll make when they start developing Cocoa programs is not the tool set: it is the shift in mind-set that is required to take full advantage of object-oriented programming (OOP). Instead of thinking in terms of procedures and data, you have to think in terms of objects—discrete programmatic units containing their own data as well as procedures that act on that data.

You can’t get far in Cocoa development without a grasp of the basic concepts of object-oriented programming. For those new to this approach to programming, it might seem strange at first glance, but a common reaction after learning a bit more is, “Yes, of course.” This chapter presents an overview of object-oriented programming from the particular perspective of Objective-C. For additional background on OOP and Objective-C, see Inside Cocoa: Object-Oriented Programming and the Objective-C Language in /Developer/Documentation/Cocoa.

Learning how to program with objects takes some initial effort, but in a very short time, object-oriented programming begins to seem natural, elegant, and powerful. And, with the rich functionality of the Cocoa frameworks to tap, application development becomes easier—you get a huge number of application features “for free.” Programming with objects, especially Cocoa objects, increases your productivity by freeing you from many repetitive coding tasks. You have more time to accomplish what ...

Get Learning Cocoa 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.