You're not going to get rich out of this. Let's just get that out of the way so we can move onto saner ground. If you are hoping to retire at the age of twenty-five, go forth and write iPhone games, and good luck.
But if you are a computer hobbyist, if you simply enjoy playing with bits and bytes, if you just like to write a program for the thrill of seeing it work, and putting it online in case someone else finds it useful, then you should seriously consider writing apps for Haiku.
Hai-what? Glad you asked. Haiku is an open-source x86 operating system that tries to recreate the look and feel of the BeOS that you may remember from the 90s. Think of it as "like Linux, but back when Linux was still fun, before the men in the suits took over." It is partially POSIX-compatible, but not based on a Linux or BSD kernel. The file system has flat-file database built in. It does not have a "please wait" cursor built in, because it runs fast and smooth, and app sizes tend to be small. I'm not going to sing Haiku's praises in this post. Just go to haiku-os.org and read up on it.
Compared to Linux, this is a tiny community, where everybody knows everybody else. On the other hand, it is pretty much the last man standing out of what was once a flourishing field of hobbyist operating systems. Once-promising OSs like AtheOS are barely surviving. The Haiku community, like a collection of your favourite bickering relatives, keeps going on doggedly.
So why should you be writing apps for Haiku? For one simple reason: you can be the first. Does Windows need another flat-file database? Does Mac OSX need another wall-paper utility? Does Linux need another text editor? Of course not. Those systems have been around for decades and it is really, really hard to think of a new sort of app for which there aren't already a dozen well-established alternatives.
Haiku needs EVERYTHING. Can you write a word processor? This is your chance to be a hero. Write something that will read and write the common document formats and do the basic word processing functions on Haiku, and everybody in the community will install it. You have the chance to be the first, to be the author of that program that all the other programmers have to compete against.
You like to write tools and utilities? Have I got a project for you. Python runs on Haiku, but only in text mode. There was an app called Bethon from the BeOS days that gave Python hooks into the API, so you could write GUI apps with Python. Bethon desperately needs an overhaul. People are trying to create API hooks for Lua and FreePascal. Those people need your help.
You don't want to start from scratch, but you do like to take something that already exists, see how it works and fix it? There are hundreds of old BeOS programs, with source code available, that just need a little attention to become functioning Haiku citizens again. Or you can port QT4 and Java apps - more about that later.
You can do this on many levels. If you like to be all indie and just put up your stuff on your own website, do that. You can give your app to haikuware.com for wider distribution. You can join haikuporter and get your apps into the official repository. Or you can start working on the OS itself. Sadly this is where we tend to lose app developers - they get sucked into the main project.
OK, what do you get to work with? Let's start with writing small command-line utilities. You get C, C++ and Python out of the box. Perl, Lua and Ruby are easily available. The command line, by the way is the same bash shell you already know from Linux, BSD and Mac OSX. FreePascal can be installed. The Go language is being ported. There are a variety of BASIC interpreters and if you really insist, you can install oddities like Cactus and Gwydion Dylan. If you can write in Assembly, you probably don't need to read this article.
Things are more restricted if you want to write GUI programs. The official way is to write in C++. That is what the Haiku API is really aimed at. And we're talking about programming the old-fashioned way, with a text editor and a terminal. On Haikuware you will find half a dozen graphical IDEs in need of maintenance. You want one, pick one up and fix it. Please?
There is an excellent tutorial available, called Learning to Program with Haiku, that takes you from absolute beginner to C++ Haiku programmer. Actually the course and the never-officially-published sequel are freely downloadable, but just go to Lulu and buy the thing, OK?
Your other option is yab. This is a version of Yabasic with Haiku API hooks, and it is entirely addictive. Hey you, stop turning up your nose. Yes, it is BASIC, but it is a modern BASIC: no line numbers, no GOTOs. yab has only recently been accepted into the official repositories. Try it, you'll be surprised at the way you can throw up a bare-bones, but fully functioning graphical text editor with 130 lines of code. Tell you what, I'll paste it in at the end of this post for you.
With C++ you can write any kind of program. yab is a little more restricted. You shouldn't try to write a graphics-heavy game with it. But the yab community is continually stretching the boundaries of what this language can do. Both the official yab IDE and my own alternative IDE were written entirely in yab.
As I've mentioned before, the possibilities of writing graphical apps for Haiku in Python, Pascal and Lua can best be described as "work in progress". But there are two other possibilities.
QT4 has been ported to Haiku, and it is possible to port QT apps to run on Haiku. This is controversial within the community. Ports that have simply been recompiled without closer attention don't look right on a Haiku system, and they ignore the features like extended attributes that make Haiku different from other operating systems. But in time. QT may well become entrenched as Haiku's second API and people may start writing QT apps specifically for Haiku, not just porting existing ones.
More recently, OpenJDK was ported, and the Haiku community is still cautiously feeling its way into the world of Java porting and programming. Right now, Java apps look even less Haiku-like than those ported from QT. But that too may change.
And that is why you should write apps for Haiku: a small but fanatically devoted community that will snap up your program, the satisfaction of being the first to bring a new kind of app to the platform, and mostly, well, it's just more fun.
yab example program: Teditor, a yab text editor in 130 lines of code
I could squeeze this down to 100 lines, but readability would suffer. your browser will probably wrap some of the longer lines.
############# Prologue #############
ProgramName$ = "Teditor"
AuthorName$ = "Joe Bloggs"
ProgramVersion$ = "V0.1"
ProgramBriefDescription$ = "My unbelievable first yab program."
ProgramLicense$ = "Public Domain"
ProgramAcknowledgements$ ="With thanks to clasqm for creating Teditor!"
## Technically, yab does not require you to declare global variables, it just is a really, really good idea to do it anyway.
// set DEBUG = 1 to print out all messages on the console
DEBUG = 1
//change this to DEBUG = 0 when you are ready to bind the program for distribution
#######End of Prologue#######
############# Main Message Loop #############
nCommands = token(message$, msg$(), "|")
for everyCommand = 1 to nCommands
if(DEBUG and msg$(everyCommand)<>"") print msg$(everyCommand)
leavingLoop = true
textedit set "EditSpace", "undo"
textedit set "EditSpace", "cut"
textedit set "EditSpace", "copy"
textedit set "EditSpace", "paste"
case "MainWindow:Edit:Select All":
textedit set "EditSpace", "select-all"
Alert ProgramName$ + " " + ProgramVersion$ + "\n" + "by " + AuthorName$ +"\n\n" + ProgramBriefDescription$ + "\n" + ProgramLicense$ + "\n" + ProgramAcknowledgements$, "OK", "none"
#######End of Main Loop#######
//Close down the main window
window close "MainWindow"
//Create menu in MainWindow
menu "File", "Quit", "Q", "MainWindow"
menu "File", "New", "N", "MainWindow"
menu "File", "Open", "O", "MainWindow"
menu "File", "Save", "S", "MainWindow"
menu "Edit", "Undo/Redo", "Z", "MainWindow"
menu "Edit", "Cut", "X", "MainWindow"
menu "Edit", "Copy", "Z", "MainWindow"
menu "Edit", "Paste", "Z", "MainWindow"
menu "Edit", "Select All", "A", "MainWindow"
menu "Help", "About", "", "MainWindow"
if textedit get$ "EditSpace" <> "" then
sos = alert "Save Current Text First?", "Yes", "No", "", "none"
if sos = 1 SaveFile()
textedit clear "EditSpace"
local file2open$, anewline$
file2open$ = filepanel "load-file", "Open Which File?", "/boot/home"
if file2open$ <> "" then
open file2open$ for reading as #1
line input #1 anewline$
textedit add "EditSpace", anewline$ + "\n"
textedit set "EditSpace", "gotoline", 1
//Setup the main window here
window open 100,100 to 600,500, "MainWindow", "Teditor"
textedit 0,20 to 499, 399, "EditSpace", 3, "MainWindow"
textedit set "EditSpace", "wordwrap", 0
local file2save$, filename$
file2save$ = textedit get$ "EditSpace"
if file2save$ <> "" then
filename$ = filepanel "save-file", "Save File As ...", "/boot/home"
if filename$= "" return
open filename$ for writing as #1
print #1 file2save$