logo

 

     
 
Home
Site Map
Search
 
:: Bitwise Courses ::
 
Bitwise Dusty Archives
 
 
 

rss

 
 

ruby in steel

learn aikido in north devon

Learn Aikido in North Devon

 


Section :: software

- Format For Printing...

REALbasic 2006 Professional

With the demise of Visual Basic 6 is REALbasic an alternative?
Saturday 1 July 2006.
 

One of the consequences of Microsoft’s abandonment of the old-style Visual Basic is that there is now room in the world for Visual Basic clones. Previously, you would have had to have been slightly peculiar or have a very good reason indeed for not using Microsoft’s Visual Basic 6 (VB6). After all, it was the standard for components – thousands of them available to do everything from graphing and charting to database access. But now the hegemony is gone – shattered. And the gap has allowed other Visual Basic plants to bloom…

GIF - 14.6 kb
You start off in REALbasic with a fairly standard IDE environment. It’s a good bit cleaner looking than the Visual Studio equivalent.

REALbasic from Real Software isn’t simply a VB6 clone. It does have a VB6 like syntax, but it is its own Basic, so to speak. While the language is pretty similar to VB6, it is in fact object oriented. This shows up immediately if you try to use a VB6 style date in REALbasic. In VB6, a date is intrinsic to the language while in REALbasic (as in VB .NET) it’s a class. However, apart from things like that, REALbasic is much nearer to VB6 than VB .NET is to VB6. In general, old style VB programmers won’t take too long to get used to the REALbasic dialect.

When you start REALbasic, you’ll see a rather plain IDE style environment. Double clicking on the Window icon generates a familiar form canvas with a ‘toolbox’ on the left and a ‘properties’ window on the right, displaying the set of properties associated with the selected object. You can’t dock the properties window or move it around, and I found that the resizing of the window was a bit jerky – possibly it isn’t double buffered.

If you are coming from Visual Studio 2005, you may find that some of the features you are used to aren’t there (see below for more on this). For example, selecting a font name for an object is done the old-fashioned way – you type it in; there’s no font selection dialog. However, you can enter all the required properties of an object via the properties window – it may not be fancy, but it is clear and easy to use.

GIF - 6.1 kb
You enter the properties of an object using the Properties window. It looks rather plain, but it serves the purpose.

Now, in the good old Visual Basic style, you can double click on a button (say) and get to where you enter the code. Essentially, you are switching between the layout mode and the code editor and you can switch back easily using icons on the toolbar. In the code editor, you can now enter code. It’s here that you’ll start to notice that REALbasic is object oriented. The me keyword gives you access to the methods of the enclosing object, so you can set the caption of the button like this:

Me.Caption = “hello”

In contrast, VB6 will set the caption of the form not the button. An interesting difference. And, on running the program, clicking the button does indeed change the caption of the button.

Duck Basic

There’s a term used in programming (and in other walks of life no doubt): ‘Duck typing’. If it walks like a duck, etc, then it is a duck. So is REALbasic a ‘real’ Basic then?

To start with, REALbasic is a fully object oriented language: Visual Basic 6 isn’t. But in addition to object hierarchies, etc., there are a number of ‘intrinsic’ functions which can be used independently of any object: like Len, for example; so writing Visual Basic-like syntax is pretty easy. While REALbasic doesn’t implement all VB6 functions like this, it is simple to add the missing ones.

It seems that one of the problems that VB6 users face in moving to VB .NET is that a lot of familiar keywords just aren’t there. The old style Left, Mid, etc are replaces by class methods of ‘string’. OK, once you get used to it, fine … but it just adds to the burden of moving. In contrast, In REALbasic, a lot of these familiar keywords are there and ready to use.

Used by itself, REALbasic is an elegant and simple implementation of an object oriented version of Basic. It’s got all the usual and familiar syntax but ‘straightened out’. Dim statements do what you expect and - better than in VB6 - do what they should. So the statement:

Dim upper, lower As String

Does indeed declare ‘upper’ and ‘lower’ as String, and not, as in VB6, Variant and String.

The REALbasic language also contains the try … catch … finally exception handling that is now common in Java, C#, etc. If you are used to the old fashioned Visual Basic On Error thing, then using this will come as a revelation.

Overall, though, there isn’t much in the REALbasic language itself that will surprise any Visual Basic programmer. Unlike VB .NET, REALbasic looks, feels and smells like Visual Basic 6. That’s not to say that upgrading a Visual Basic 6 project to REALbasic will be a cinch. There are sufficient ‘gotchas’ to make life difficult if you aren’t careful. For example, REALbasic doesn’t support nested procedures. In the guide to upgrading from VB6 (very good and readable, actually), the VB6 GoSub statement is dismissed as ‘GoSub not supported, so replace with functions/methods as required’. The point is that GoSub isn’t just an antiquated way of calling a procedure, it is in fact a nested procedure call. If you use this a lot, you will have difficulty upgrading.

As I’ve pointed out above with the me keyword, there are subtle language differences due to the object oriented nature of REALbasic, but once you get used to these, VB6 programmers won’t have too much trouble in coding in REALbasic.

GIF - 17.6 kb
Apart from the C style // comment (quote and Rem are also accepted), this code should be pretty familiar to VB6 programmers.

Conversion woes

Real Software provides a separate tool to help convert your Visual Basic projects to REALbasic. I tried this out with a simple VB6 project that I’d written a short while ago – one that bit shifts a 64 bit value by a given number of places and displays the result. Not rocket science, by any means.

I have to say that the results were not spectacularly successful. My first attempt to import my VB6 project failed with a null exception error. The upgrade tool presents you with a form from which you can import a VB form file. It turns out that you have to import the project file – which is not the option displayed by default. After a couple of similar problems – hitting the cancel button causes an ‘out of bounds exception’ and the "Save as type" combo in the Save As dialog box that pops up doesn’t have any types in it - I got a project that I could load into REALbasic.

Unfortunately, it didn’t compile. The first problem was a Visual Basic line:

Dim upper, lower As String

Now I’ve been sloppy here. The upper variable is a Variant, but I’d intended it to be a string - it works fine in VB6, though, but it’s probably typical of the type of thing that will need attention when you convert. However, the converter correctly imported upper as a variant – and forgot about the lower bit. On checking the report produced by the converter, there was a TODO note saying that a Dim statement was unsupported. But it didn’t say which Dim statement, nor on what line number. Actually, it did tell me a line number (63), but I couldn’t match it up with the actual line number in the file (119) or the line number displayed by the Visual Basic 6 IDE (28).

So I fixed the error by adding a lower string as a new property – by the way, REALbasic is very neat about the way it organises variable definitions and the like, much better than VB .NET – and then I moved on. The next problem was an error with a Format statement ‘Parameters are not compatible with this function’. Ok – so the question is which parameters? What is the problem?

I checked again in the project conversion report. There wasn’t a note about this error, just a complaint about an apparently unrelated type conversion operation on an apparently random line. And again, the offending line of code was not in the conversion report.

But it got worse: the converter produced gibberish. This is an example of a perfectly good line of VB:

inputValue(1) = inputValue(1) And &H3FFFFFFF

and this is what the converter produced

inputValue(1) =  inputValue(1) And + H3FFFFFFF

Now it turns out that REALbasic is rather stricter than Visual Basic over the use of logical and bitwise operators and that there is a BitWise class that does the job: you cannot just use the And keyword as I have done. That’s OK. But what isn’t OK is the production of rubbish. Either the converter should produce correct code or it should fess up and say clearly that it can’t do it.

On a final note, I thought I’d see how Microsoft’s much maligned (not least by me) conversion wizard stacked up. Yes, it did complain about my sloppy VB syntax, but after slapping me on the wrist and making me fix it (and pointing me accurately to where the problem was, by the way), it converted the program perfectly.

GIF - 10.3 kb
The REALbasic converter and I did not get on well: we did not part on speaking terms.

The IDE

To my mind, the IDE is central to most forms of programming development. There are places where an IDE isn’t much use (device drivers, say), or where it can be a hindrance (pure Perl scripts, for example). But for most programmers, most of the time, the IDE is where you live. And if the IDE doesn’t do the job or it doesn’t somehow ‘fit’, then you’re in trouble. Now, I’m going to be upfront here. I use Visual Studio 2005 much of the time and for the most part, I’m pretty happy with it. I think it would be true to say that I have an inbuilt bias towards Visual Studio. So with that in mind, I’m going to be totally unfair and compare the REALbasic IDE to Visual Studio.

Adding code in REALbasic is done in a sort of Smalltalk-ish way. You select a method (‘Action’, say) and just type away. You can’t see all of the code for a given object in one go as you can in VB6 or VB .NET. This is something that I would find useful (maybe I missed an IDE option to do this?), but, on the other hand, it does enforce a modularity of style which is often missing in VB6 code.

As you’d expect, the REALbasic IDE has a fully integrated debugger. As in Visual Studio, you can set a breakpoint and the IDE will halt execution at the breakpoint so you can examine the variables. However, unlike Visual Studio (even in VB6) you can’t change the value of a variable. Nor is there any ‘edit-and-continue’ which, it has to be said, has only recently returned to Visual Studio 2005. In Visual Studio, you can not only set a breakpoint, you can also configure the breakpoint to fire after a given number of hits or when a specific condition is met. In the REALbasic IDE, you can hit a breakpoint or not – that’s it. But on the other hand, I’m not sure that this is really such a big limitation – the fact of the matter is that I don’t think I have ever used ‘advanced’ breakpoints in over five years of using Visual Studio .NET.

Visual Studio comes with a number of additional ‘goodies’ that REALbasic lacks. In Visual Studio you have an inbuilt icon editor. Admittedly, it isn’t very good and it’s easy to crash Visual Studio with it, but it is there. With REALbasic you can import icons, but not edit them.

I can’t say that I’m devastated by the lack of an icon editor in REALbasic, but there is one thing which I do miss – Visual Studio’s ‘solution’. A ‘solution’ is a collection of sub-projects under one heading. This really comes into its own when handling complicated and large projects. The one I’m writing at the moment has seven subprojects, each of which can be independently compiled under both ‘release’ and ‘debug’ build scenarios. As far as I can see, In REALbasic, you would have to have individual projects which you would then bring together with a distribution tool.

GIF - 15.2 kb
One of the nice features about the IDE is the ability to store ‘notes’ – chunks of comments or code which are not compiled into the output, but are there for future reference or use.

As I’m writing this, I’ve got Visual Studio 2005, Visual Studio 6 and the REALbasic IDE open. It’s pretty clear to me that the REALbasic IDE is much closer to Visual Studio 6, both in functionality and operation, than it is to Visual Studio 2005. But, apart from all the functional and stylistic differences there’s one other thing that’s really quite noticeable … REALbasic really is fast. It’s a lot snappier than Visual Studio 2005 (apart from the window resizing effect I mentioned above). On the other hand, Visual Studio does a lot more and is far more configurable: you just need a GB or so of memory and the fastest processor you can afford to run the beast.

What isn’t so hot though is how REALbasic deals with syntax errors. By default, it stops looking for syntax errors after it has found the first one, so it can take a few goes through the code before you’ve got something that will actually compile. To get it to behave in a more (to me) normal fashion, you have to set a Build Process option.

The error descriptions aren’t that wonderful, either. Often, I seemed to end up with a plain ‘syntax error’. Now, I know from my own experience of compiler writing that a ‘syntax error’ is the compiler writer’s ‘cop-out’: it’s the easy (and lazy) way of dealing with a problem. The limited syntax checking isn’t a fault of the IDE, it’s more of a property of the language parser and compiler. The current Microsoft C# and VB .NET compilers are really quite good at telling you what’s wrong. On the other hand, the REALbasic system is a lot better than VB6 where you had to click a dialog box every time you mistyped a comma.

The bottom line, though, is ‘can I live with the REALbasic IDE?’. The answer for me - surprisingly given all the negatives in comparison with Visual Studio that I’ve listed above - is ‘yes, easily’. The IDE is simple and clear in its layout. Additionally, it’s both fast and robust (I can crash Visual Studio without too much trouble but so far I’ve never been able to crash the REALbasic IDE). The REALbasic IDE gets the job done.

GIF - 17.6 kb
Adding a method or function to an object is done by selecting Add Method, trying in the name and the arguments and then the body. It’s slightly different to how you would do it in Visual Basic, but neater.

Summary

It’s interesting to take a step back: if you started out with VB6 and wanted to make it into an object oriented system, integrating it into a shiny new framework that you’d just invented, how would you go about doing it? To me, the answer is staring right back at me from my screen – it’s REALbasic.

Let’s see: REALbasic syntax is pretty similar to the old VB6 syntax and in principle (that is leaving aside the little matter of the converter), it looks feasible to translate from VB6 to REALbasic. Next, you’ve got a simple object hierarchy which is visible in a clear fashion from the ‘browser’ in the left side of the screen. It doesn’t get in the way and groups together all the components of the project that I’m working on. In other words, the fact that its object oriented doesn’t dominate – it works naturally with the structure of the IDE. Lastly, the object framework is of a size that a mere mortal can understand. This isn’t the place to into yet another rant about how Microsoft screwed up over Visual Basic .NET, but I think you can see where I’m coming from.

But let’s not depart too much from reality. Real Software is a small company (at least compared to Microsoft) and has limited resources. Functionally, the IDE doesn’t compare too well with the latest incarnation of Visual Studio. But on the other hand, it is robust, fast and as I’ve said, does the job. If you were thinking of switching from VB6 to REALbasic, you’ve still got a fair task in upgrading – it’s not automatic and it’s probably not going to be trivial, even if the language is closer to VB6 than VB .NET. In addition, there are other factors involved with moving to another variant of Basic – garbage collection and COM’s deterministic finalisation being among the nastier problems that may lurk in the woodwork.

On the plus side, REALbasic is multiplatform. It will run on Linux and Mac platforms – more than you can currently say of any Microsoft product. Real Software promote this aspect of REALbasic quite a lot. Personally, I think that multi-platform operation is somewhat overrated, but it is important to some companies. If you are upgrading from VB6 and think that there are market opportunities out there in the Linux and Mac worlds, then I would consider REALbasic very seriously indeed.

The downside to moving to REALbasic from VB6 is the rather poor converter program. Maybe I just got the conversion tool on a bad hair day. Maybe I had a bad hair day. But the task I asked the conversion tool to perform wasn’t very difficult and it didn’t do a good job: it did not point out clearly what the problems were and what I should do to fix them. I don’t want to make a big deal about what is a small part of the REALbasic product, but if I had been evaluating REALbasic as a commercial alternative to Visual Basic 6, I might well have moved on at this point.

This is a real shame, because REALbasic is an excellent product and a good and viable alternative in many cases to VB6. The converter is surely how you demonstrate to potential customers that your product can do the business for them. Put it another way, it’s the best salesman Real Software has got. Real Software say that they are re-writing the converter – and I look forward to playing with the new one. If I was Real Software, I wouldn’t just re-write the converter, I would be putting every conceivable effort, every hour of the day into making the converter the best possible tool for getting VB6 users onto my product. There are an awful lot of very, very annoyed VB6 users out there looking for a home. They need is some decent help to find one. They don’t want VB .NET: they want VB6 or something close. And in my view, REALbasic is the closest fit I’ve seen so far.

Prices
REALbasic comes in two editions Standard at $99.95 and Professional at $399.95. You can purchase it directly from Real Software’s web site or via a distributor. See www.realsoftware.com for details.
AddThis Social Bookmark Button

Forum

  • REALbasic 2006 Professional
    16 July 2006, by SloopJohnB

    The part you mentioned about VB.NET not supporting Len, Left, Right, Mid, etc. is just plain wrong. The Microsoft.VisualBasic namespace supports all this. And that namespace is set up automatically when you create a VB.NET project.

    I just tried the following code in a VS 2005 console project, and it worked just as any VB programmer would expect it to work.:

    Module Module1
    

    Sub Main() Dim testString As String = "John Smith" Console.WriteLine(Left(testString, 4)) Console.WriteLine(Right(testString, 5)) Console.WriteLine(Len(testString)) Console.WriteLine(Mid(testString, 4, 3)) Console.ReadLine() ’ So that you can read the output End Sub

    End Module

    I think that some of the confusion might come from some who think that the Microsoft.VisualBasic namespace is evil and tell everyone not to use it. That is wrong. This classes and methods in this namespace perform just fine. On the other hand, the Compatability namespace (which tries to handle such things as VB6 style arrays, etc.) is much slower, and shouldn’t be used unless strictly necessary to port VB6 code. I think this may be where some of the confusion arises.

  • REALbasic 2006 Professional
    11 July 2006

    “On the other hand, the REALbasic system is a lot better than VB6 where you had to click a dialog box every time you mistyped a comma.”

    You should be aware that the "Auto Syntax Check" dialog could be turned off.

  • REALbasic 2006 Professional
    5 July 2006

    Dear Sir:
    - Thanks for this article - I looked into REALBasic several months ago, and I find I agree with most of what you write. Especially as regards the translation tool from VB6 - it simply is/was not ready for prime time. Otherwise, the only issue I found is that the resulting application files do not (seem to?) run as fast as VB6 versions of the same thing. Not sure if this is fact or perception (or maybe I’m better with VB6 than with REALBasic!)
    - Again, thanks for the review!

  • REALbasic 2006 Professional
    1 July 2006, by Steven Burn

    Unfortunately, whilst RB is extremely attractive, as with most others, freeware developers such as myself cannot afford the price :o(

    Something which forever escapes me is how they come to the price band without considering us mere mortals ...

    • REALbasic 2006 Professional
      4 July 2006

      I reckon they just add up all their development costs plus a little extra so they can go on vacation in Hawaii every once in a while, if a group of mere mortals can’t afford to generate their income then they just have to be ignored.

    • REALbasic 2006 Professional
      9 July 2006

      Some of us have to make a living off of our software development and investments.

      If you can’t afford it, then the software was not made for you.

      ...this open-source crap has got everyone expecting ALL software should be available for free...GET A JOB and stop being a mouse-potato!

      • REALbasic 2006 Professional
        17 September 2007

        Seems you are threatened by us Open Source guys... wonder why that is?

        • REALbasic 2006 Professional
          13 February 2010

          "Seems you are threatened by us Open Source guys... wonder why that is?" For the same reason, paying Chinese workers 1/10 of what American workers make has ruined the manufacturing sector in this country. Like it or not, the bills have to be paid in "real" jobs.

    • REALbasic 2006 Professional
      11 July 2006

      RealSoftware is on the right track here. If you want a FREE version of RealBasic, then get the Linux version. Of course, you can only design Linux apps with it, but heck, you want free right?!?

    • REALbasic 2006 Professional
      1 September 2006

      $99 for REALbasic Standard Edition is not at all unreasonable. And I think they even discount it lower than that for students and teachers.


Home