- Computers & Software»
- Computer Science & Programming
FreeBasic Programming Language
FreeBasic is an easy to use programming language with a shallow learning curve. It can be used advantageously to write simple utility software, games, or to prototype maths algorithms. You can also use it to create shared libraries (.dll, .so) and as a simple way to access the power of low level (x86) assembly language programming.
Setting up FreeBasic
Firstly download and install FreeBasic from the FreeBasic web site. Initially you will want to avoid dealing with compiler options and other complications. Using dedicated editing software such as FBIde will keep things simple and allow you to compile and run your source code at a keystroke.
Advantages and Disadvantages
To use or not to use a particular programming language is a big issue. Here are some of the advantages and disadvantages of FreeBasic.
- It has an simple learning curve. Beginners will not be overwhelmed with complexity. More advanced programmers can learn the ropes very quickly and make use of more complex features without difficulty.
- It has a clear and simple syntax. You can read, understand and reuse other people’s code easily. FreeBasic largely prevents showoff code laden with coding tricks, stunts and other obfuscations.
- It has some simple built-in graphics capabilities. This is very useful for presenting the results of engineering or maths utility software.
- It is easy to use external code libraries. By design FreeBasic can easily make use of either static or dynamic code libraries. Principally those designed for use by the C programming language. For example the Cairo library for 2D drawing, FreeImage for manipulating many digital image formats, BASS for audio applications and may others.
- It is easy to include x86 assembly language code into FreeBasic. It provides a good framework to write high performance code with minimal difficulties. The resulting code can be compiled to a shared library and used with a different programming language.
- It has facilities for writing Macros to provide some level of support for writing Generic code.
- Only fixed length arrays may be used in user defined types (UDTs) and Objects. In many cases this makes using UDTs and Objects impossible. This automatically dictates against the use of FreeBasic for large scale applications.
- Lack of graphical user interface (GUI) support. Some easy to use but non-standard GUI code is available for FreeBasic. More standard and more complete GUI support is available by using external shared libraries. However in practice it becomes an exercise in unwanted complexity. To be fair to FreeBasic similar problems are found in many modern programming languages such as D, GO and Processing.
- Limited means to structure and organize code. You can organize code as modules or by using namespaces. Using modules is awkward. Namespaces are a better option.
- Underlying use of C programming language zero terminated strings. FreeBasic uses C programming language file handling functions at an underlying level. This results in the requirement of several different string types and problems when trying to load and save data containing zero value bytes.
- Documentation. The documentation is written by people who are friendly to FreeBasic. They tend to cover-up difficulties or awkward facts in order to present FreeBasic in a positive light.
- Hidden shared variables. Undocumented changes in hidden shared variables can sometimes cause problems in file handling.
- No simple to use debugging. Debugging and single-line stepping through code has become something of a lost art among modern programming languages.
FreeBasic is a good choice for writing short pieces of utility software. Often it is a simpler and better choice than a scripting language. It is also a good choice for writing assembly language code with some high level support.
In it’s current form it is unable to scale well to more complex projects. FreeBasic is still being maintained, however there is not much active feature improvement. In particular feature improvements related object orientated programming have been stalled for years.
It is a programming language you can use productively in certain situations and is semi-professional. Many of its faults are also to be found in other modern programming languages.