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 076

OOP University: Introduction

Recently, REALbasic University received and published some letters from people who have been frustrated by "Object-Oriented Programming" (OOP). Most of these are people who have some traditional programming experience, perhaps many years ago, in other languages. They understand basic computer language concepts like loops and variables, but are befuddled by modern programming concepts.

I have great sympathy for these people, for I understand how frustrating programming can be if you're struggling with the basic concepts. REALbasic is supposed to be so easy: so why is it so difficult?

The main letter that inspired my concern was from Ben Gravely -- take a moment to read it and my response (the link will open a new window so you won't lose your place here).

To help those in Ben's situation, I've decided to take a little break from our normal RBU routine of building applications from scratch and try a little lecture series that will cover some of the real basic basics. Even if you think you're a decent RB programmer I hope you'll find some of this explanation helpful. In fact, I'm expecting it will help me! (Teaching is always a great way to really learn something.)

Improvements to REALbasic University

Since this is a holiday week (at least in the United States), I don't want to strain your brain too much, so we'll begin light and get into serious lecture mode next week.

First, as I was working on this "OOP University" series, I received a email on the very topic from Terry Findlay. Here's what he had to say:

Hi Marc,

I was browsing the RBU achives and I came across a letter from Ben Gravely in column 062. He talked about his wish that there was a web resource that spoke to real beginners. He said, in part, ³I have not seen a single tutorial that describes what the structure is all about and how it works. Oh, there are plenty of books that go down to 10,000 feet in about three pages and claim to be for beginners. Hogwash! The only way I can learn a new pgm architecture is by examples."

He went on to give some examples of the kinds of things that he would like to be able to find out about: what are the meanings and uses of the all the event areas under an editfield? How does the code flow? How to capture key strokes? How to build a simple table of values - a spreadsheet - that you can motor around in and enter and erase entries - very hard. How to do column math with a qty, description, price, and total column. How to open a file to read a name. How to specify the path to a particular folder, so I don't have to navigate to it each time? How to print? What does a canvas mean?

As you pointed out in your reply, some of these are pretty basic but some are fairly complex (the spreadsheet idea). However, it got me thinking about my own experience when first attempting to use RB. I had a fairly extensive background in AppleBasic, HyperCard, SuperCard, FileMaker Pro scripting, and a bit of Applescripting. Even so, RB with its oop based approach was something new for me and it took a fair amount of slogging to get anywhere at first. At the time, the only resource I had was the tutorial that came with RB (somewhere around version 1.x). It helped but it wasnıt really newbie friendly.

I agree with Ben that small examples (snippets) are a good way to learn programming. This is how I learned most of the other programming and scripting languages that I have used over the years. As far as I have been able to discern there are a number of excellent web resources available to those who have already got going with RB (RBU, ResExcellenceıs RB column by Erick Tejkowski , RBıs own web site, etc.) However, I have not been able to locate one that speaks to the needs of those like Ben who just need a few important fundamentals to get them over that first hump.

My idea is this: a web site dedicated to the real fundamentals of getting started in RB. Terms such as: property, event, method, function, class, module, etc. would be explained and examples given or how to work with them. Basic methods for I/O, printing, graphics, flow control, etc. could be presented. I envision a home page with links to pages for a Glossary, Basic Operations, an OOP Explanation, RB Objects Explained and so on. Also, an email link to send in questions, requests, etc. as well as links to RB Garage, RBU, ResExcellence, realsoftware.com, etc. The site would be called "REALLYbasic: The Real Basics of Programming with REALbasic."

However, before I go spending time and energy on such a project I thought it might be prudent to ask you if you know of any thing like this that is already being done and, if not, if its your sense that there is a significant need for a site like this.

I know you must be very busy but any feedback would be greatly appreciated.

Cheers,

Terry Findlay

My response to Terry was that I didn't feel an entirely new REALbasic site was necessary: this strikes me as the ideal sort of content for REALbasic University. But how do we integrate Terry's idea into RBU?

Ah, that is the question. Terry has volunteered to help and we're going to be revising and updating RBU to include some great guides for beginners (and pros as well). For instance, one idea that made sense to me is to expand the RBU Glossary. Instead of just defining terms, why not include code snippets that actually demonstrate the feature being discussed? Take the editField control: it's described in the glossary, but there are no instructions on how to use it. FolderItems aren't even mentioned, yet they're something that every user struggles with, especially at the beginning.

With these additions, I see the RBU Glossary becoming a valuable code snippet resource. Obviously the glossary format needs to be revised to support this, and it's not going to happen overnight. But keep an eye out for the future: cool improvements are coming!

If it wasn't enough of a coincidence receiving a letter from Terry talking about Ben's letter right as I was thinking about it, I next got a letter from Ben himself!

Marc,

Some while back (article 062), I wrote a note commenting on the difficulty of learning OOP using RealBasic. Subsequent comments ranged from agreement that tutorial information explaining the operation of RB is inadequate, to comments that maybe old dogs can't learn new tricks. Being an "old dog," I chuckle when someone dismisses the heart of a matter with a euphemism. In truth, one has to learn more tricks and learn them blind, when instruction is inadequate. What really happens is that the faint of heart, or the ones who don't have strong enough conviction, or large amounts of time just quit, and their possible contributions are lost to the rest of us. In my case, I use the challenge in my recreation time when I am winding down from a busy day.

Now back to the point. The program I mentioned earlier - a purchase order/invoice program is now finished (for the first time) except for printing out the form. The four page program includes a menu page that has both key stroke (pull down menu) and button press selection of the next page - including forward and back key strokes similar to Netscape.

Two name files can be entered/saved/recalled (bill to and ship to). All the links are remembered, so they can be saved/recalleld from the address they came from. The order form page is a list box that acts like a spreadsheet. A file is read that has the items to be ordered/billed with prices. Quantities are selected (numbers only), and the extension and page totals are presented in formatted dollar amounts. A "zero key" allows quantities to be erased so another order can be processed.

The totals page is fully formatted to look like a printed page. It includes a logo box (all text) with company name and address, a date box that is automatically entered and an invoice number that is calculated from the year number, the day of the year, and the time of day presented as a three digit fraction of 24 hours, ie 02-324.567. I did the invoice number this way because I wanted a sequential numbering system, but didn't want to remember and index an integer numbering system - just my preference. The totals page allows the tax rate to be entered and the shipping/handling costs. All numbers are formatted and justified to the right - no mean task to figure out. Justification selections in the property window don't work in RB4.0.2.

The last undone task is printing the totals page to paper. I haven't even tacked this yet, I am still looking for information. Again there are no good examples of transferring a complex page to a printer, just fairly disjointed bits and pieces of info scattered around. One thing that works immediately is the use of Apples "take a picture" command OA-4. The picture can then be printed in short order. This work around is rather crude, but it works fine. Maybe there is a simple way to write a RB script, or Applescript to do this automatically and skip all the hassle of doing it inside RB.

I am curious as to how an expert would have accomplished the tasks in this program. I know I need to consolidate the global items. I still have no idea why some parts of this work and other trys didn't.

While there are plenty of improvements and mods to be made, the program is now approaching usability. I am attaching the code for you to examine. This program contains the skeleton I use for all my programs, so getting it going ensures another 4 or 5 programs will appear shortly.

Regards,

Ben Gravely

Fascinating, Ben! Thanks for the update. I'm glad you made some progress, but I'd love to help you the rest of the way. Here's what I propose: how about a "makeover" column?

This is done in the graphic design field (my background) all the time. A designer takes a shoddy looking newsletter and redesigns it to look gorgeous, publishing an article showing the before and after and explaining the reasoning behind the changes. When I was starting out in graphic design, those columns were my favorite: I learned so much from them as they were practical examples.

If you're game, and your ego can handle being publically criticized, I'd like to do a "makeover" of your program. Basically I'll look at the code and rewrite it the "correct" way (keep in mind that there are many correct ways to do things), and then I'd publish a comparison of the two methods. It would be extremely instructional for all readers.

If others of you are interested in such a thing, perhaps we could make "makeovers" a regular part of REALbasic University. Send me your crappy source code!

Next Week

We begin "OOP University" with a look at event-driven programming.

News

The December/January issue of REALbasic Developer hits the stands in December and here's a brief preview of what's inside:

Write your own Quake!
Ever thought about writing your own "first-person shooter" game? Didn't think it was possible to write Quake in REALbasic? Then turn to page 18 as Joe Strout shows you how in our cover story!


Book Excerpt
The long-awaited REALbasic for Macintosh: Visual Quickstart Guide by long-time author Michael Swaine is being published and we've got an excerpt! Take a test read and decide if you need to add this book to your programming library.


REALbasic 4.5's QuickTime Features
When REALbasic 4.5 was released last summer, it added so many exciting new features many people missed all the improvements made to RB's QuickTime support. We've got an article by Erick Tejkowski (author of REALbasic for Dummies) which will bring you up to speed on using QuickTime in REALbasic 4.5.


Interview with a CEO
Few CEOs answer customer emails or post answers to technical questions on mailing lists, but REAL Software head Geoff Perlman does. This is a president who knows his product. Curious about who he is and what he has planned for REALbasic? Read my interview with Geoff starting on page 11 of this issue.


More
Plus we've got our regular columns focusing on topics like Algorithms, OOP, Databases, 3D, Q&A, reviews, RBD news, and more!

New subscriptions placed in October will be mailed the second issue at the end of the month. (Current subscribers will receive their copies in October.)

Individual copies of any of the issues may be ordered via our back issues order form.

Letters

No letters this week.


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.

Email This Article - Comment On This Article

.

Reader Specials

Server Racks Online:
Apple Xserve CompatibleServer Racks and Universal Network Racks
42U KVM Switch Solutions:
High-End Mac and Multi-Platform KVM Matrix switching solutions!
Digital Camera Online:
Great prices on Digital Cameras and accessories!
KVM Switches Online:
Great prices on Mac KVM Switches from the leading manufacturers!
LCD Monitors Online:
Great prices on LCD Monitors from the leading manufacturers!
LCD Projectors Online:
Shop online for LCD Projectors from the leading manufacturers!
USB 2.0 Online:
Great prices on USB 2.0 products from the leading manufacturers

Serious Business Software:
Accounting, Sales, Inventory, CRM, Shipping, Payroll & more!

KVM Switch solutions for MACs:
DAXTEN is a KVM switch, KVM extender and monitor splitter specialist for PC, SUN and MAC applications from name brand manufacturers - offices worldwide.

The "Think Different Store: The iPod Accessories Store - iPod cases, iPod mini, iPod photo, speakers, itrip, inMotion, Soundstage and all other iPod accessories

Earn Cash with the ThinkDifferent Store Affiliates Program

Need A Web Site?
Applelinks Web Hosting Starting at 19.95 a Month

iTunes_RGB_9mm

.

iTunes_RGB_9mm

Cool Mac Gear


iPod 1G-2G
iPod 3G
iPod 4G
iPod Mini
PowerBook-iBook
Keyboard Skins
Garageband