REALbasic – Review

REALbasic
Standard version $99.95, (academic $59.95)
Professional $299.95, (academic $179.95)

http://www.realsoftware.com

People considering programming for the Mac will face some significant obstacles. The creation of a user interface (with windows, buttons, text, etc.) requires learning a horde of Macintosh-specific programming commands called the Toolbox. The procedural languages most programmers start with may not be appropriate for the event driven Mac OS. In addition, the code compilers such as CodeWarrior can serve as a major discouragement to a casual programmer.

With the release of REALbasic 2.0.1 (RB, from REALsoftware), these barriers have been reduced: RB is loosely based on the BASIC language, allowing beginners to get a gentle start on its learning curve. It extends BASIC to include Object Oriented Programming (OOP) concepts and event driven programming. It allows the visual editing of the user interface and handles the Toolbox calls necessary for the function of menus, windows, and control. Perhaps most importantly, it brings these features in at a price of about $100. RB is not solely the domain of hobbyists, though. It works well with Microsoft’s VisualBASIC, and a pro-version adds database functionality and compilation for Wintel systems. These features make RB useful for more advanced projects and customized institutional programming.

The Language: This is not high school BASIC
I would imagine that many readers are like me, whose exposure to BASIC came years ago while using an Apple II or some form of pre-Amiga Commodore. With that sort of background, it will not be difficult to create functional code within RB. All the familiar commands are there: For-Next loops, GOTO statements, etc. Many of the easy string manipulation and math commands of BASIC appear, too, such as mid(), mod(), and asc(). Like some versions of BASIC, RB does not require strings to be of predetermined length, allowing a great deal of flexibility.

Where RB shines, however, is in its extension of the BASIC syntax with concepts derived from modern OOP languages, such as Java. A user can create their own objects, which can be either new or based on an existing object (called “subclassing”), including most of RB’s built-in objects. Such custom objects can be moved between projects and reused. Like Java, RB’s runtime engine handles memory management and does automatic garbage collection on unused memory blocks. This eliminates the worst features of memory pointers and helps to prevent the most common cause of crashes and memory leaks. Should things still go wrong, RB allows users to code customized error traps or defaults to letting the program die gracefully with an informative error message.

RB treats a program’s interface as a collection of objects. Its built-in objects include the major interface items common to Macintosh programs: menus, windows, listboxes, text, buttons, graphics, etc. Non-interface objects also exist: timers, TCP/IP sockets, threads, files (resource, binary, and text data are available), and many others. The most appealing feature of RB is that it eliminates the need for a programmer to learn the multitude of Toolbox commands necessary to create, modify, update, and trigger windows and controls. Updating is handled automatically, and the rest of the control’s behavior is controlled by a limited and simplified syntax. Each control respond to user activity by executing specific code; thus, when a button is clicked on, its “action” event is triggered, and any code placed in that event is then executed. If a programmer finds the built-in capabilities too limiting, RB2 now allows direct toolbox calls.

The Interface: Learning to use objects and events
On launch, RB’s interface presents the user with a project window, a tools panel containing all the built-in control objects, the project’s main application window, and a properties palette. The project window allows you to manage all the windows, custom objects, pictures, etc. associated with a project. Double-clicking an object brings up a code-editing window to allow its modification. Double-clicking a window opens it, allowing visual editing of its controls. Controls are added simply by dragging them from the tools palette; they can be removed by selecting them and hitting the ‘delete’ key. Selecting a window or control brings up its attributes in the properties palette, letting you change its name, size, location, initial status, etc. Double-clicking a window or control brings up a code editing window identical to that used for objects.

RB’s Interface: clockwise from upper left, the Tools palette, the project’s lone window, its Properties editor, the project manager, and a code editor, with the popup menu’s “change” event selected.

 

REALbasic Picture 2Perhaps the biggest step in adjusting to RB is simply in learning where to type your code. Those used to using an IDE such as CodeWarrior or a procedural language (such as the original BASIC) may be at a loss for what to do first. RB’s interface practically forces a user to learn to think in an object oriented and event driven manner (don’t worry, that’s a good thing!). In the screenshot shown above, a code editor for Window 1 is open, revealing a list of its controls (currently only one). Each control includes the events associated with it; in the case of a popup menu, there are 7 such events. Each event can have code in it, which will be executed when that event occurs. Events without code are ignored, and no code needs to be executed in order for the program to wait for an event. Windows also have events (such as open and close. Any window or control can also have menu handlers, methods (functions) and properties (variables) associated with it, allowing greater flexibility in organizing information.

The Caveats
With so much going for it, is there a downside to RB? There are several, but their significance may vary according to your needs. In releasing version 2, RealSoftware has had to balance adding new features with enhancing existing ones and squashing bugs. The number of remaining bugs may be too large for some users to tolerate and some existing features may appear limited or quirky, depending on a programmer’s needs (printing in particular seems quite limited). Version 2 has already had one bug fix released and a second is in the works.

The Pro version of RB adds database and Windows compilation to the package, but these capabilities are currently bug-plagued, and do not appear to be ready for extensive use. In addition, RB as a whole lacks some of the features that are required for larger projects. The debugger lacks an object browser that will reveal the status of all objects and their properties during debugging; instead, this information must be dumped to a text file by a coded command. In addition, there is no way to do version control on objects imported into a project, making integrating the work of multiple programmers or updating a reusable code library a significant headache.

Although RB is object oriented, its implementation of OOP features is not complete compared to other languages, and differs from them in significant ways. The same can be said for its event model, and some expected events may be lacking some interface objects (for example, a listbox has no “mouse down” event), and a programmer has no straightforward way of adding them. So, although RB can serve as an introduction to OOP and event driven programming, this experience will not translate directly to other programming languages. Conversely, experienced OOPers may find themselves frustrated by RB’s implementation. RB is also both a compiler and a language (unlike CodeWarrior, which has compilers for several languages). As such, it is a bit of a moving target; practices learned for one version may need to be changed when the next is released.

Finally, RB provides a runtime environment that separates the coder from the Toolbox and handles memory management. The amount of time this saves in creating a functional program requires a sacrifice, which is exacted in terms of performance, customization, and memory. Even the simplest RB programs will require about 1 MB of RAM and disk space on a PPC machine. When doing calculations and string manipulation, the equivalent code written to a text window with C in Code Warrior executes noticeably more quickly than the RB version. Finally, RB gives you ready access to the most common building blocks of current Macintosh programs. If you want to do something uncommon or want extensive control over your program’s behavior, it may not be the best choice.

Summary
RB is a wonderful addition to the Mac platform, but it may not suit everyone’s needs equally well. Because of its relatively simple syntax and ability to separate the user from the toolbox, RB is Highly Recommended for those people new to programming or who don’t have the time to devote to learning Apple’s Toolbox. Its low price and ability to work with Microsoft Visual Basic make it Highly Recommended as an additional tool for those who specialize in small, custom applications. The Pro version is not currently in a state to properly evaluate. When more polished, it would be Recommended for those who need its cross-compilation or database capabilities, though it does not have a complete enough feature set to be used for large development projects.

MacMice Rating: 5
5


Jay Timmer
jtimmer@tuna.net

Websites mentioned:
http://www.realsoftware.com

Leave a Reply