Gambas

Homepage | Download (12.0 MB)
Version: 2.7
License: GPL2
Rating:


Once upon a time, nearly all computers came with a copy of the BASIC language. In fact, Micro-Soft’s first product was a BASIC interpreter for the Altair 8800. The BASIC language was thousands of people’s introduction to programming. It was the perfect tool for the speedy development of simple programs.

But then came the age of the graphical interface, and something new was required. The variant of BASIC that rose to the forefront was Microsoft’s Visual Basic, a language still popular today. It has, however, two major drawbacks: Visual Basic costs money, and it only works with Windows. Three, actually, if you count its great bugginess.

Happily, for freedom-loving Linux users like us, there’s an excellent alternative: Gambas.


Gambas is a complete development environment, consisting of both a BASIC interpreter (with object oriented parts, for GUIs and such) and a graphical code/form editor front-end. Besides writing classic text-based BASIC programs, it can be used to create desktop applications using either Qt or GTK+, use OpenGL and SDL for 3D and 2D graphics, and handle printers, networking, databases, compression, XML, audio, and video.

Because of this impressive list of features, Gambas also has a lot of dependencies. Luckily, they’re (almost) all listed in the readme file, and, if you choose to compile it from the sources, the ./configure script will tell you which components will not be compiled, based on which libraries are available. The reason I say ‘almost’ is because the readme does not mention what libraries the component gb.qte (for embedded applications) depends on, so I was unable to build it; but most people won’t be making embedded apps anyway.

An easier way to install Gambas is to get the binaries for your distribution. Many distros include Gambas in their repositories, so you may also be able to install it with your package manager, and install all dependencies automatically.

Then, execute the command gambas2 to begin. A small window will pop up giving you the option of starting a new project, opening an old one, or trying one of the numerous example programs; and also providing a nice list of the most recent projects opened. The examples are excellent, demonstrating almost every area of Gambas’ feature-base, as well as demonstrating how to use the Gambas language. But the finest example of what Gambas can do is the Gambas IDE itself — yes, it was written with Gambas BASIC!

To start writing your own program, you naturally click New Project… This will take you through a user-friendly wizard in which you choose what type of project to create (and therefore which libraries to use), what directory to store it under, and what to call it. Then comes the main Gambas window, and development can begin!

The window is split into three panels, by default. On the left is an overview of your project structure, listing the forms (window layouts, basically), classes and datafiles the project contains. In the center is the main workspace, where pretty much everything goes on. Click on a form in the list on the left to show it in the central panel, ready to be covered in widgets. Open a class, and the center area comes up with a screenful of code. Even icons can be edited in the central workspace, using rudimentary draw and fill tools. And this panel in the middle is tabbed, too, so that you can have multiple things open at once. The rightmost panel only shows when the center area is editing a form, in which case it displays a palette of widgets and a table of properties.

The creation of a graphical Gambas project usually follows the pattern of creating a form, testing it, coding, testing, and repeating. To design a program’s look and feel, widgets are selected from the palette and added to the form, and then their settings and default values are edited, in the Properties table. Double-clicking on a widget will open up the form’s class file, taking you to that specific widget’s subroutine. Then you can type in some code to modify the widget’s behavior (made easy and enjoyable with Gambas’ auto-indentation, keyword highlighting, and code-completion), and, thanks to the interpreted nature of the BASIC language, instantly try it out by clicking the Play button at the top of the screen.

People who’ve used Visual Basic (or even old non-Visual versions, such as QBASIC, GWBASIC, Applesoft BASIC, etc.) will find it easy to start programming with Gambas. There are differences between the two languages, but a great many similarities, as well. For those who’ve only ever used C++ or something, or are non-programmers, it’ll be a bit more difficult. However, Gambas comes with excellent documentation, explaining every keyword and function, and there are some good tutorials available, as well. At least three books (four, if you count WikiBooks) have been written about Gambas, though only one of these is in English, and all three are for a slightly outdated version. But possibly the best way to learn is by reading code and messing around with it, starting with that of the many examples included. There’s also a website, gambasforge.net, which hosts a large quantity of simple open-source programs written with Gambas.

Gambas programs are fully translatable, as well. To enable translations, go to Project -> Properties -> Options and set “Project is translatable” to Yes. Then you can click the translate icon on the toolbar, and start a new translation. The window that pops up lists all translatable strings (such strings being the text on widgets, and strings within your code enclosed by parentheses), to each of which you can provide a translated string in the language you’re translating to.

And then when you’ve completed a project, and want to share it with the world, you can compile and package your program. Gambas includes a compiler, which converts a project into an executable binary, making it runnable from a terminal, clicking on an icon, or any other way any other program can be run. Such executables are not machine code, like C++ compilers put out, but rather bytecode, which must be interpreted. It still runs extremely fast (the Gambas IDE is a testimony to this), but because it’s interpreted, certain components of Gambas must be installed on the user’s computer for the program to run. This could turn into a bit of a pain for those non-you people who use your program, so, quite fortunately, Gambas also comes with a very convenient packaging wizard. This will walk you through the process, as you fill in your project’s description, changelog, and desired menu location, and then you can select from a list of package types. You can create Debian, Fedora, Mandriva, OpenSUSE, Slackware, Ubuntu, and/or Autotools packages, with the click of a button. Then the dependencies will automatically be fulfilled, on the end-user’s machine. It can’t get any easier than that!

The best feature of Gambas, though, is the speed with which you can develop a working program. A very simple, yet fully functional web browser can be written with just 25 lines of code! With an intuitive interface, great documentation, and a robust feature-set, Gambas is the ultimate tool for speedy software development on the Linux platform.


This entry was posted on Tuesday, June 17th, 2008 at 12:48 pm and is filed under IDE, Languages. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

 

2 Responses to “Gambas”

  1. Nic Says:

    If you know nothing about C or Visual Basic and only know the very old BASIC then Gambas will get you up and running very quickly. Obviously if you know more it is a very powerful tool.

    Positives - You can write very complex programs with lots of features very quickly.

    Negatives - If you are very inexperienced in modern languages(VB, C), like myself, then the lack of a definitive textbook (written for the idiot) is a problem - however the structure and ease of test running allows for a “trial and error” style of syntax appreciation.

    It Works !

  2. Cash Loan Advance Says:

    Cash Loan Advance…

    Easy cash loan program providing payday cash advance for US residents….

Leave a Reply