yab: BASIC for BeOS
0033 - March 1st, 2007

yabThe Be operating system is written mostly in C++ and C and so is almost every application. For lot’s of tasks C++ is very nice language, powerful and readable.
However for smaller applications there’s sometime the desire for a easier and more basic language. This is were yab comes in. The Beginners All-purpose Symbolic Instruction Code,
or BASIC is a language that was first designed to help people understand the basics of computer programming, but also proved to be suitable for writing applications. Nowadays there are
a lot of flavors of BASIC, like pureBasic or the well known Microsoft’s Visual Basic. Yab is a BASIC flavor especially for BeOS/Zeta/Haiku and is heavily based on yabasic, a free BASIC implementation
running on Windows and Linux. With yab being a full programming language it is possible to develop any kind of application you want, and especially nice is that yab makes it very easy to use parts
of the BeOS API to create native and consistent looking interfaces.

An example:

To show you how easy it is to program small interfaces with yab, here’s the code for the most basic of all applications. People who have some Visual Basic programming will recognize the style of code,
for instance by the lack of ‘;’ characters. Overall the code looks more like a scripting language, then like languages as Java, C or C++.

HelloWorld in yab:
window open 200,200 to 500, 600, “MainView”, “Hello World”
draw text 100,100, “Hello World”, “MainView”
sleep 5
window close “MainView”

Yab applications consist of source files with commands like the code above which are run by an interpreter. The interpreter is current only just over 1 MB large, and can therefore easily be
distributed together with the application. Typically you will compile your sources into a binary file after development for distribution.
With yab it is possible to create almost any BeOS ui control that is in the API, plus even some other controls like a Date/Time picker, and a check button. Besides the BeOS ui controls there are
all the other things that make up an application like loops, conditions, arithmetic functions and so on. Anyone who has ever written code with another BASIC flavor will be familier with the structure
of yab code. One of the strong points of BASIC sourcecode is that it is very easy to understand what is happening programmatically by just reading the code. Because of this yab has a learning curve that
is a lot less steep than C++, and anyone can create simple apps within minutes. The yab language also makes it possible to create interfaces a lot faster then while writing C++, which is important
because that leaves more time for the actual logic of the program you are working on. Having a language for BeOS like yab also will attract more students and hobbyists to create BeOS applications.


Developing yab applications is basically writing code and testing against the interpreter, and all you need a text editor. But yab also comes with an IDE that can instantly run your project to test it,
created binaries of your code and has a code editor with yab specific syntax highlighting and auto-completion. Below is a screenshot of what the IDE looks like. On the left is listing of the currently opened files, the right
part holds the code editor.

yab-IDE screenshot

yab-IDE, click for larger image

Besides a nice code editor, yab-IDE also has a good documentation system, there are descriptions for all the commands and functions that are available for you to use in your code.

yab-IDE screenshot

yab-IDE help, click for larger image

With the yab-IDE you can run your project with a click, to test it. This means no more waiting for a compiler to finish while you are testing your application. You can also run your application in
a shell, or keep track of debug output in the Output view. What the IDE also can do for you is build your finished application into a binary that can be run on any BeOS/Zeta system. This will make sure
that people can’t see the yab sourcecode and also makes sure that people don’t need to install the interpreter to run your application. Besides this the IDE comes with a handy color picker and the code editor has
all the mandatory features like search and replace, auto-indent and an option to reformat your code.


By enhancing yabasic with the BeOS specific API, compatibility with other operating systems then BeOS is broken. However a new project is started to get yab applications working cross platform.
With Flyab it will be possible to run yab applications on Windows, Mac, Linux and of course BeOS. In order to do this Flyab uses the ‘FL’ (Fast Light) toolkit, and at this moment over 40% of the original yab
commands are implemented. Although the FLTK doesn’t provide 1 on 1 compatibility applications with simpler controls like buttons, listboxes, checkboxes should allready run outside of BeOS. Flyab is far from
finished though, some important things like a layout system that works in the same way as in BeOS still needs a lot of work and FLTK is inferior to the BeOS API when it comes to the look and feel of a lot of
ui controls. Below is a screenshot impression of how applications originally written for BeOS could look like on another platform.

Flyab screenshot

Flyab apps, click for larger image


Yab is a very impressive project, while there still are some features missing, and a couple og BUGs in the IDE, yab is almost at release 1 quality. Although the BeOS API is very nice to work with and
a good way to learn more about programming, it can sometimes be very challenging for a beginning programmer to create application for BeOS. C++ also isn’t the most ideal language when introducing people to
computer programming. Yab is a very good way for unexperienced developers to start writing code in BeOS with a low learning curve. Another important aspect is that it takes less time to create interfaces and the
produced code is much easier to understand without lot’s of commenting. There is already a lot of information available on the net on programming with yab, and it seems that yab really lowers the doorstep to start
developing on the BeOS platform. If Flyab succedes then code written originally for BeOS is easily ported to other platforms, this will broad the audience for developers and thus hopefully attract more developers and
with that more user for BeOS. Below you’ll find some more information on yab.

Yab is developed by Team Maui , a German based group of creative BeOS users who develop applications for BeOS.
The main developer is Maui team member jan__64.

Category: Reviews   -   Comments RSS   -   Post a Comment   -   Trackback  

« »