REALbasic Cross-Platform Application Development

THERE ARE TWO PARTS TO REALBASIC. The first part is the language itself and the compiler. This is what turns programming code, written by a human being into machine code, to be read by your computer. The second part is the Integrated Development Environment (IDE), which is the application the developer uses to write REALbasic applications. In other programming languages, these two aspects are distinct pieces of software. In REALbasic's case, they are tightly integrated. There is no separate compiler to run, nor can you use a different editor to edit REALbasic code (that's 99% true). If you're an experienced developer, there may be times when this kind of tight integration feels constricting because you do not have as much flexibility as you do with other compilers or IDEs. At the same time, it also makes life easier because REALbasic stores all your code for each application in a single file and you don't have to worry about importing classes into source code files and managing packages like you do with Java, Python, C, and so on.

In addition to being an object-oriented programming language, REALbasic is also an event-driven programming language. Programs that are used to develop applications with graphical user interfaces (desktop applications in REALbasic parlance) often use the event-driven paradigm to manage program flow. Because the subject of this chapter is developing desktop applications, it is also a chapter about the event-driven aspects of REALbasic programming.

Up until this point, a large portion of this book has been devoted to the REALbasic programming language syntax. Understanding syntax is a necessary foundation to writing a program; it is not the only tool you need to develop effective applications. Just like a person may know the meaning of a lot of words and how to place those words into sentences, and even how to understand what others mean when they use words, it is not necessarily true that the same person can use that understanding to construct a persuasive argument on behalf of any particular cause. I can read a Shakespeare play but I cannot write one.

Part of the task at hand, then, is to help to get you started writing applications in REALbasic rather than writing lines of code. There are some standard approaches and design patterns that computer programmers have developed that can help to provide a framework you can use to write better programs. One such architecture is called Model-View-Controller (MVC) and it is often used when developing applications with graphical user interfaces.

I have used the basic elements of the Model-View-Controller architecture in the design of the RSSReader application. In this chapter, then, I will walk through the code of the RSSReader application and show you how I chose to implement MVC using REALbasic. It is my hope that this will provide you with a practical, hands-on feel for one way to approach the challenge of creating an application. It is by no means the only way, nor is it necessarily the best way, but it is certainly a good way to go about it and it can serve as a starting point for you, especially if you are new to programming.

I will also describe the few remaining language elements that make up the REALbasic programming language that I have yet to discuss, which includes Menu Handlers and Exceptions.

Категории