Chapter 3. Objects, Classes, and Instances

Consider programming as a way of thinking, and code as a way of speaking—a language. The programmer thinks about what the program is supposed to do, and then expresses this in code. An object is a programming construct which assists the programmer both in thinking and in speaking about the program, both in organizing and in coding. The program works as if it consisted of autonomous bundles of functionality—the objects. These objects are somewhat like the bundles of reality, the “things,” the “objects,” in terms of which we perceive and describe the natural world. Thus, the use of objects in programming makes the programmer’s thought and speech about the program more natural, which in turn makes programming easier.

What are the objects of which a program is constructed? In general, that’s up to the programmer, who, rather like some divinity creating a small universe, dictates both what objects should populate that universe (“Let there be light; let there be the sun; let there be the earth”) and what those objects should do and how they should interact (“Let the sun make light to shine upon the earth”). Such power may seem daunting, almost paralyzing, rather than helpful. Where to begin? If there were an easy answer, there wouldn’t be approximately six gazillion books about designing object-oriented programs.

REALbasic both enforces object-oriented programming and helps you with object-oriented design. Before ...

Get REALBasic: TDG, 2nd Edition 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.