Chapter 7.  The Architecture of an Application

The preceding chapters have explained how to write REALbasic code, and have discussed all the major components of a REALbasic project. The rest of learning REALbasic is just details about how to use particular built-in classes. Such details are the subject of Part II and Part III. That’s where you’ll find answers to such questions as: What is a checkbox? How do I draw a picture in a window? How does REALbasic connect to the Internet? And so forth.

But one should also give some thought to the larger context in which those details are embedded—namely, the structure and organization of your project’s entire code. Details do you no good unless your application works. Properties, methods, lines of code are pointless unless you put them in the right place. The purpose of this chapter is to help you think about your application’s overall structure. The subject here is how to organize your code.

In a program written for a GUI-based operating system, that’s no small consideration. The joy and the terror of such a program is that it isn’t in charge; the user is. Your program can’t predict what the user will do, so it must be prepared to react sensibly to whatever the user can do. Most of the time, your application sits idle, essentially asleep. Then, whenever the user presses a button, types in a field, chooses a menu item, dismisses a window, or performs any other significant action, an event arrives, and your application wakes up and gets to ...

Get REALBasic: TDG, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.