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.