JonHoyle.com Mirror of MacCompanion
http://www.maccompanion.com/archives/january2006/Columns/AccordingtoHoyle.htm

 

Newsworthy Events



According to Hoyle...

Cross-Platform Software Development from a Macintosh Perspective: REALbasic

by Jonathan Hoyle

jonhoyle@mac.com

January 2006

For those just joining us, we have been touring various cross-platform programming environments from a Macintosh user's perspective.  No longer does the Mac user feel he must choose between the Mac and Windows, as there are a number of development environments which allow him to create software which will run on both platforms (and Linux as well). After our introductory overview article, we began by reviewing many cross-platform C++ frameworks:

We leave C++ for now and move on to what is perhaps the hottest cross-platform programming environment available today: REALbasic.  Whether you are a hobbyist or a professional developer, you will likely find REALbasic to be an excellent tool to add to your solution set.

REALbasic Overview

REALbasic is a very modern application development environment implementing the Basic programming language, created by REALSoftware.  REALbasic is very similar to Microsoft's Visual Basic, with the main difference being that VB is Windows-only, whereas REALbasic can target the Macintosh, Windows and even Linux. Furthermore, REALbasic has a conversion utility to facilitate the conversion of Visual Basic projects into REALbasic.  Additionally, REALSoftware has announced that it will be supporting Intel-based Macintoshes in a future release.

Beginning with the recent REALbasic 2005 release, this product is sold as a subscription, available two ways: as the platform-specific version called the Standard Edition, or as the more expensive cross-platform version called the Professional Edition.  The Standard Edition runs $99 for the first six months, with annual renewals for $49.  The Professional Edition runs $399 for the first six months, with annual renewals at $199.  During your subscription period, any new upgrades are free to download.  REALbasic is currently available for three platforms: Macintosh (which includes Mac OS X and Classic), Windows and Red Hat Linux.  The Professional version allows you to cross-compile to all the other operating systems, as well as give you more advanced databasing capabilities and support for console application development.  Users of the Standard Edition may upgrade to the Professional Edition at any time for price differential of $299.  Academic pricing is also available.

REALSoftware provides a demo version free to download.  I strongly encourage anyone interested in developing cross-platform products to download this trial version to experience the powerful capabilities and ease of use of REALbasic.  After any purchase on their online store, there is also a generous 90 day money back guarantee if you are not satisfied.

Creating Applications with REALbasic

REALbasic is an extremely intuitive and easy application to use.  Windows users who have used Microsoft Visual Basic or Visual C# will find it trivial to learn; Macintosh developers will find it easier to use than Apple's Interface Builder.  After starting it up, REALbasic will present you with a default project, containing a window and a palette of controls.  You can simply drag and drop controls onto your window, name the controls, set properties, override behavior and add code to a control's event method.  In addition to the standard controls you will expect to find (eg buttons, checkboxes, edit fields, sliders, etc.), REALbasic provides image wells and canvases for displaying and drawing images, a movie control for displaying QuickTime movies, controls for 3D rendering, TCP network sockets, sprite controls, advanced database controllers, and much, much more.  There are a number of books available on REALbasic (see book listing below), any of which would be sufficient to get you up to speed on using it.

Below is an example of a project window created with REALbasic 2005:

Beyond GUI creation, REALbasic is also a full-fledged object oriented language.  REALbasic also contains an advanced runtime environment, which makes O.O. programming easy.  Code completion is implemented very nicely, similar to Visual Studio.  

Mixing REALbasic with C++

"But I'm a professional C/C++ developer...why should I consider REALbasic?"

Ironically, REALbasic can be even more useful to the C/C++ programmer than it is to the Basic developer.  One powerful feature of the environment is its ability to interface with C/C++ code.  You can use REALbasic as a cross-platform version of Interface Builder, by designing your GUI within it, while leaving your core logic code in C or C++.  This is done by housing your C/C++ functions inside a dynamic library, while REALbasic is compiled as the GUI application.  By doing this, REALbasic essentially absolves you of having to remember those long and cumbersome GUI API calls for each platform.  You write the GUI once in REALbasic, and spend the remainder of your time in the C++ business logic of your application.

I created a sample project exercising this model for last year's MacHack conference, which can be used as a template for your own projects: http://www.jonhoyle.com/MacHack. This example requires REALbasic 5.5 or later for the front-end GUI project, and Metrowerks CodeWarrior 9.4 or later to build the back-end project.  This back-end project contains two targets: a Carbon Shared Library for the Mac and a DLL for Windows.  Note that with Metrowerks recently departing from both Macintosh and Windows development, future back-end projects should be compiled as dylibs on Xcode for Mac OS X and as Microsoft Visual C++ DLL's for Windows.  If you would like to see the MacHack sample project likewise updated, please let me know by emailing me at jonhoyle@mac.com.  If there is sufficient interest for it, I will have it updated in time for next month's column.  For more information on creating dylibs in Xcode to use with REALbasic, visit http://www.nilobject.com/?p=184.

REALbasic Deficiencies

REALbasic's claim that it is "cross-platform that really works" is only partially true: the $99 Standard Edition compiles for only a single platform.  To truly be cross-platform, you will need to purchase two REALbasic licenses, one for the Macintosh and one for Windows.  Since the Standard Edition of Linux is currently being given away for free, you can support all three platforms for a total of $198.  .

REALbasic, being younger than its cousin Microsoft Visual Basic, is a lot less robust.  Over the years, a very large body of users has helped make VB the premiere Basic development environment on Windows.  By comparison, RB has a lot less time to clean up the bugs in its environment.  Furthermore, there are large holes in RB functionality compared with VB.  Even now, REALbasic cannot create dynamic libraries or plug-ins.  Another area of weakness is in peripheral access.  Although REALbasic offers a legacy serial control, there is no generalized USB interface.  Getting basic information from a USB device (such as retrieved from Apple's USB Prober) is simply unavailable.  REALbasic's accompanying documentation could use some improvements as well.  For overall general information, it is very good; however, detailed information is unavailable and usually requires me a post to the REALbasic newsgroup: news:comp.lang.basic.realbasic.

Most disturbingly, REALbasic seems to be forgetting their Macintosh roots and are targeting Windows users.  This is most dramatically seen in the look and feel of last year's REALbasic 2005 release.  In previous versions, REALbasic allowed you to have multiple windows open, each for different components and modules, etc., much like the user experience of Metrowerks CodeWarrior.  REALbasic 2005's look and feel, however, changed to an all-in-one window, identical to Microsoft Visual Studio's user experience.  Certainly there is nothing wrong with adding a new view, but it is just rude to remove the Macintosh look & feel without warning.  REALSoftware ought to take a leaf from Apple's book and allow the user choice on window layout, as they do with Xcode 2 and Safari with tabbed browsing.

Conclusion

REALbasic is simultaneously the easiest and most powerful way to design cross-platform GUIs.  Hobbyists can easily begin writing software applications with it, while C++ software developers can use it as a substitute for Interface Builder.  Although REALSoftware still has a way to go to make REALbasic a more mature environment, it remains an indispensable tool for any cross-platform project.  I have been involved in developing a number of cross-platform C++ projects, some large, some small, but in each case, I find that the ones which used REALbasic for GUI development were the most successful.  In some cases, the REALbasic GUI was intended as a temporary placeholder for later implementation in Qt or Java, but RB was found to be so proficient, there was no need to replace it.  As this author's personal preference, REALbasic is the only way to do cross-platform GUI development. 

Next Month:  What you've all been waiting for...Runtime Revolution!

About Us | Site Map | Privacy Policy | Contact Us | ©2006 MPN LLC.

http://www.maccompanion.com/archives/january2006/Columns/AccordingtoHoyle.htm http://www.maccompanion.com/macc/archives/january2006/Columns/AccordingtoHoyle.htm