|
||||||
An Introduction to the Boo Programming LanguageStarting to Make Object Oriented Programming Easier with BooBoo 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:
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 BooThe 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:
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 ProgramThe 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.
|
||||||
|
|
||||||
|
|
||||||