Fundamental Object-Oriented Concepts
There are only a handful of key concepts that you need to understand to grasp the essence of object-oriented programming. This section presents those key concepts along with Objective-C implementation details, where appropriate.
An object is a self-contained programmatic unit that combines data and the procedures that operate on that data. An object’s data is kept in instance variables. The functions that affect or make use of the data in an object’s instance variables are known as methods.
Like objects in the physical world, objects in a program have identifying characteristics and behavior. Often, programmatic objects are modeled on real objects. For example, an object such as a button has an analogue in the buttons on control devices, such as stereo equipment and telephones. A button object includes the data and code to generate an appearance on the screen that simulates a “real” button and to respond in a familiar way to user actions.
Just as procedures compartmentalize code, objects compartmentalize both code and data. This results in data encapsulation, effectively surrounding data with the procedures for manipulating that data. Figure 2.4 shows this relationship between an object’s data and its methods.
Figure 2-4. An object
Though it might look a bit like a jelly doughnut or a slashed tire, this symbol illustrates ...