REALbasic University Resources:

RBU: Glossary Defines common REALbasic programming terms
  Archives Previously published columns
Translations: Dutch Courtesy of Floris van Sandwijk
  Japanese Courtesy of Kazuo Ishizuka
  Chinese Courtesy of Dong Li
  RBU Translation Guide Information on Translating RBU into other languages
Books: Matt's Book (2nd Edition!) Ideal for experienced programmers
  Erick's Book Best for beginning programmers
Websites: Mother Ship The publisher of REALbasic
  RB Webring Links to hundreds of REALbasic websites
  RESExcellence Another REALbasic programming column
  REALbasic Developer Magazine The premiere source for REALbasic instruction.

REALbasic University is Sponsored by

Make your Mac do what YOU want it to. Create games, utilities, cool Mac OS X tricks. Download REALbasic now and create your own software.


Print This Article

REALbasic University: Column 001

Welcome to REALbasic University!

RBU is a new weekly tutorial column on Macintosh programming, using REALbasic, the development environment I like to call the "heir to HyperCard."

Like HyperCard, REALbasic features an elegant IDE (Integrated Development Environment), a simple script-like language, and powerful automatic features that make writing your own software programs almost as easy as drawing a picture of what you want it to look like.

Unlike HyperCard, however, REALbasic applications are real Macintosh applications. They may not have all the speed of C++, and not everything in REALbasic is as simple as it should be, but you might be surprised how many REALbasic-created applications you already have on your computer. Many popular programs, such Aladdin System's Intellinews or Toby Rush's NetCD were created with REALbasic.

Those of you who read my summer series on Mac programming as part of my regular Less Tangible column on MacOpinion should be familiar with me. I'm the author of Z-Write, a new kind of word processor which I wrote entirely in REALbasic. I'm not a classically trained programmer, though I did take an introductory course in programming in college. That should be a help in writing this column, as that means if there's a naive mistake to be made, I've no doubt done it. Part of my teaching philosophy is that to learn, you've got to make mistakes -- so we'll be exploring common mistakes and solutions within these columns. I'm not necessarily trying to teach you proper programming techniques, but help you learn enough to develop quick solutions for real-life problems you face.

I have one goal with this column: I want to teach people how to program. Far too many people think programming is a horrible, scary, complicated thing full of mathematics and obtuse jargon, which it is, but it doesn't have to be that way. Writing your own program can be one of the most rewarding experiences you'll ever have. Learning programming will reduce the fear and mystery of computers and increase your amazement at the sophistication and occasional pure stupidity of modern software.

REALbasic University is going to start at the beginning, assuming you, the reader, has never even written an AppleScript. Most of these columns are going to be a series of tutorials, with lots of step-by-step hand holding, so no matter what your Mac experience, you'll be able to follow along and learn REALbasic. (These columns will build on one another, so the archives will be invaluable for going back later, to relearn a particular technique or start of a tutorial series.)

Thus the first few columns will be extremely basic and may not appeal to REALbasic veterans. Take heart! While I'm gearing this toward the novice, eventually we'll be writing some real projects -- games and handy utilities -- and along the way we'll be tackling specific problems that REALbasic newbies often face, like adding a cool "About Box" to your program, or saving files with your program's custom icon.

Send in Your Questions

At the end of each column, I'll be answering select reader questions -- send your REALbasic University questions to rbu-question@stonetablesoftware.com. I can't promise to answer every question, and keep in mind I'm not going to be writing a novel for each answer, so priority will go to simpler questions that have universal appeal. Keep your questions specific. (A general query like "How do I write my own web browser?" will be rejected.) I'm also open to suggestions for projects and issues you'd like me to cover in future columns.

Things You'll Need

Obviously, you'll need a copy of REALbasic. You can download a free demonstration copy of REALbasic from REAL Software. The demo is fully functional for 30 days and applications you create will stop working after five minutes, but it's sufficient for you to get started learning programming. When you're ready to buy REALbasic, REAL Software will simply send you a registration number which will fully activate your copy.

REALbasic is sold in Standard and Professional versions. I recommend the less expensive Standard version unless you have particular needs for compiling Windows applications or database programming (the two main features the Professional version adds). The Windows compiling feature isn't bug-free (to say the least), and it's quite complicated making a program that will run on both Windows and Mac OS. Besides, the Standard version lets you try out the Professional features, and you can always upgrade later if you decide you need to.

If you don't already have a copy, get ResEdit 2.1.3 from Apple as we'll eventually need that. A graphics program like Adobe Photoshop or the shareware GraphicConverter will also be useful.

(Note: as of February 12, 2001, the current version of RB is 3.0. This newly released version features an improved interface and compiling for Mac OS X. For the moment, Im still using RB 2.1, so some of my screen shots might look a little different. Ill be switching to 3.0 soon. When you download RB 3.0, you can download either the "Classic" version, which runs under Mac OS, or a version that only runs under OS X.)

Installing REALbasic

Once you've downloaded REALbasic, simply decompress it with Stuffit Expander and drag the resulting "REALbasic 3.0" folder to a convenient place on your hard drive.

The first thing I usually do after installing REALbasic is to increase the amount of memory allocated to REALbasic. REALbasic programs tend to use a lot of RAM, and since you have very little control over how that RAM is used, your program will probably just crash if it runs out of memory. The simplest solution (other than bugging REAL Software to give us better memory management) is to allocate plenty of memory to your programs. Within the REALbasic IDE (Integrated Development Environment, a fancy way of saying "the editor where you write programs") you'll need even a little bit more memory, since the editor itself uses a few megabytes. I usually double the default allocation; if I'm using a machine with plenty of RAM, I'll add twenty megs. (Keep in mind that while writing your program, before you make it more efficient, you might inadvertently use more memory than you think.)

So while you're thinking about it, select the REALbasic application icon, do the "Get Info" command, and increase the memory partition.

Starting Your First Project

When you launch REALbasic, it opens a blank, untitled project. A project is your program's source. It contains everything you create for your program: code, windows, menus, resources like sounds and graphics, etc. It is very important that you manage your project and everything associated with it carefully.

For instance, a typical project will include graphics: icons, pictures, etc. You can place these in your project and REALbasic will show them, but they aren't actually saved in your project file. Instead, RB (I'll abbreviate REALbasic as RB occasionally) simply includes a reference to the original file. This makes it easy to update your graphics (just edit the original file), but don't you dare throw away the original graphic or your project won't work! (REALbasic will complain and ask you to find the graphic when you try to compile your program.)

What you should do is create a folder in the Finder for your project. I name mine the name of my project. Inside that folder I sometimes have other folders for graphics and other resources (help text, notes, sounds, etc.). This keeps everything organized. (On larger projects, I have an "old stuff" folder where I put old copies of my project, graphics I had planned to use but I'm not any longer, layered Photoshop files, etc. That way I'm not permanently throwing away something I might later want, but it's not in my active area.)

Advanced Tip: I do most of my programming on my laptop, but I also have a desktop machine and sometimes I switch between the two, depending on what I'm doing. I've found creating a small disk image file (I use Apple's DiskCopy program and create a 10MB or 20MB disk image) for my project is a great way to keep everything with a particular project together. Since it's a disk image, I can create folders and files within it, yet it's just a single file, ideal for transporting between machines. (It's also convenient for making backup copies of your entire project by just duplicating a single file.)

Next Week

We'll explore the REALbasic IDE and learn our way around.


About the Column
REALbasic University is a weekly instructional column on programming with REALbasic and is brought to you by REALbasic Developer, the magazine for REALbasic programmers.

Each week we answer select reader questions, and we're always open to ideas for future columns. Send your questions to . (Keep your questions simple and specific. General queries like "How do I write my own web browser?" will be neglected.) Your question won't be answered immediately, but will be answered in a future column. (If you don't want your correspondence published, just be sure to indicate that when you write. Otherwise it's fair game.)

About the Author
is an author, philosopher, graphic designer, photographer, film director, soccer fanatic, and programmer (among other things). He writes for MacOpinion, runs his own software company, Stone Table Software, which sells the revolutionary Z-Write word processor, and is Publisher and Editor of REALbasic Developer. He lives in Northern California with his cats, Mischief and Mayhem, and is rapidly running out of free time.

See the REALbasic University Archives


REALbasic University contents ©2001-2004 by Marc Zeedar and REALbasic Developer. All Rights Reserved.

.

.