An Introduction to the Boo Programming Language

Starting to Make Object Oriented Programming Easier with Boo

© Mark Alexander Bain

Jul 2, 2009
An Introduction to the Boo Programming Language, Mark Alexander Bain
Boo is an object oriented programming with the ease of use of Python and the advantage of type inference. Why make programming harder than it need be?

The key concept behind the Boo programming language is that having to cast the type of every single variable and method is all very well first thing in the morning, but by lunch time it's getting a bit tedious and by 3 AM it's an absolute nightmare.

So, if these computers are so clever, why can't they do some of the tedious parts of programming? After all, how many data types are there that can return “True” or “False”? Therefore what Boo gives the programmer is:

  • an object oriented programming language
  • the programming structure of python
  • type inference
  • compatibility with the .NET framework and Mono

This means that the programmer has access to a very powerful, but simple, programming language and it's one which they have up and running in a very short time.

Obtaining Boo

The Boo compiler can be downloaded from the Boo web site. It comes as set of compressed files that should be unpacked into a suitable location (such as C:\Boo). Once that's been done then Boo's bin directory can be added to the System's path and then the developer can:

  • use any text editor to write code for their Boo programs
  • compile their program from the command line

Alternatively any SharpDevelop users will find that they can create Boo projects (as shown in figure 1 at the bottom of this article).

Writing and Compiling a Boo Program

The code for a Boo program is the same regardless of whether the programmer is using a text editor or the SharpDevelop IDE (Integrated Design Environment). And the simplest Boo program consists of just a single line:

print "Hello, World!"

If this is saved into a file named “HelloWorld.boo” then it can be compiled from the command line:

booc -o:HelloWorld HelloWorld.boo

This will create an executable called “HelloWorld” which can then be run (as shown in figure 2). However, having said that the same code can be used in both methods, the SharpDevelop application will actually need some additional code. Not because of any different functionality, but simply because the compilation process will open a console, run the code and then close the console again. The additional code just needs to allow the user to have time to read the message:

import System
print "Hello, World!"
print "Press any key to continue . . . "
Console.ReadKey(true)

The result of this can be seen in figure 3 and, of course, the code will work equally well in the console method. It also shows just how easily a programmer can write a simple Boo program and then start extending it to provide a very powerful and versatile application of their own.


The copyright of the article An Introduction to the Boo Programming Language in Computer Programming Languages is owned by Mark Alexander Bain. Permission to republish An Introduction to the Boo Programming Language in print or online must be granted by the author in writing.


An Introduction to the Boo Programming Language, Mark Alexander Bain
Figure 1: Create a BooProject with SharpDevelop, Mark Alexander Bain
Figure 2: Compiling Boo from the Command Line, Mark Alexander Bain
Figure 3: Compile and Run Boo in SharpDevelop, Mark Alexander Bain
 


Post this Article to facebook Add this Article to del.icio.us! Digg this Article furl this Article Add this Article to Reddit Add this Article to Technorati Add this Article to Newsvine Add this Article to Windows Live Add this Article to Yahoo Add this Article to StumbleUpon Add this Article to BlinkLists Add this Article to Spurl Add this Article to Google Add this Article to Ask Add this Article to Squidoo