Gambas RAD
This How-to applies to:
All
This How-to is intended for:
Desktop Power User
Rapid Application Development for Linux
I came across Gambas a little while ago purely by accident, and was totally amazed. After searching for many years for a development platform that might be Linux's answer to the likes of Delphi and playing with immature projects that I'd thought might be usable one-day, it turns out the answer was there all the time staring me in the face.
GAMBAS is effectively "visual basic" done from scratch for Linux. (note however it's not directly compatible with VB, it just provides a similar platform, language and feature set).
Maturity
So, how usable is it really? Well we use it in live applications and have no issues with it staying up either when running as a server or as a desktop application. So in terms of stability I'd say it was about as stable as any other major stable RAD. Certainly it doesn't crash when you use it in development mode, and although it's possible to crash it out if you do something nasty enough with an external library, generally it's rock solid.
What's it got in it's pocketsez ...
Pretty much everything and it keeps expanding. Not only does it have access to Qt and Gtk, there is a new (albeit not totally complete yet) option when you start a project for "Graphical Application" (rather than Qt or Gtk project). This introduces a sandwitch layer between the graphics toolkits and the application, so effectively you can generate a tooklit independant application. Not sure if this is a first but it's certainly pretty rare!
How well does it work in this context? Well I've written a fairly complex webcam application with server and desktop components which captures information from an AXIS webcam and stores the frames in a MySQL database .. then provides a tooltraybased GUI which will let you monitor the DB and playback live or stored footage. This is all toolkit independant and indeed you can choose whether to run with Gtk or Qt when you run it inside the RAD and it certainly works for me.
This might sound like a relatively trivial feature but after you've spent 3 months writing a new application to work with Qt, when you hear some someone say "ok, so what about all our Gnome users, that will work in the Gnome tool tray won't it?" , you will find it suddenly becomes extremely importent.
OpenGL / Performance
This is a shot of the example "Gambas Gears" application that emulates the X11 "gears" toy which is often used as a rough benchmark of X11/OpenGL performance. The Gambas version gives around 500 FPS whereas the raw X11 version gives me .. well, pretty much the same really. This makes me think that it's entirely possible to write game-type applications in Gambas in addition to non-real-time type applications.
Real Applications
But are there any "real" applications for Gambas and indeed is it possible to write your own real applications that are going to survive in a commercial environment?
I think so and indeed have invested some time in writing a tool which is used to manage the provisioning for all of our systems. We are fairly fortunate in that our infrastructure is driven entirely from MySQL based tables so in effect we're just talking about a table maintenance system, albeit there's a fair bit to it. We include DNS record maintenance, website definitions, mail forwarding and mailboxes, remote machines / monitoring, remote ssh access, renewal tracking and integration of the ZenOSS monitoring package. All of these features (internal and external) are integrated into the main application shell and seem to work fairly smoothly.
The development GUI
So what do you get? Well, pretty much everything that's missing from all the alternative options. After you've selected your toolkit (Qt/Gtk/Generic) you have a large palette of components from which you can choose, these are all drag and drop onto the canvas as you would in Delphi or VB, this includes standard networking components including CURL, HTTP etc. There is a highly language aware syntaxing, colorising integral editor with many very useful options including the ability to search a project including or excluding commented text, which is very useful if you're commenting out old code and want to make sure it's gone (!)
There's the compiler (still looking for something that takes more than a second to compile) and a full stop / pause / step / breakpoint debugger, again much the same as the commercial competition .. albeit I've never found one this easy to use or this stable before.
Generally speaking it's all done "very well" and all the options are where you're hoping they will be, which is a really nice change from failing to find the options you want where you expect them to be.
Object Orientation
Every language has a slightly different twist on OOP and Gambas is no exception, albeit it has all the standard features of other OO languages, Gambas seems to make it so easy you don't even want to write a monolithic application. I've just finished a short application to scan a website and calculate internal PR ratings based on Google's probability distribution algorithm and started off thining, "single thread" , "for next loop", could be a large block of code.
I was only 5 minutes in before thinking, "this would be so much easier to read if" ... and found myself creating the first class.
Here's a general idea of what a class file looks like;
'Gambas class file PRIVATE $temperature AS Float PROPERTY READ Status AS String PROPERTY Temperature AS Float PUBLIC SUB _new() $temperature = 0 END PRIVATE FUNCTION Status_Read() IF $temperature > 0 THEN RETURN "Ok" ELSE RETURN "Too Hot!" ENDIF END PRIVATE FUNCTION Temperature_Read() RETURN $temperature END PRIVATE FUNCTION Temperature_Write(temp AS Float) $temperature = temp END
Further information
You can get more information from the following locations;
Happy Programming!

