Programming With Haiku
Lessons by DarkWyrm
Since I started publishing my Learning to Program with Haiku lesson series back in January, I have, on many occasions, seen comments asking for lessons aimed at current codemonkeys who want to break into development for Haiku. Here begins a new series of programming lessons aimed at people who already have a basic grasp on C++: Programming with Haiku.
While I have a basic outline for the series, it's very general and I'm not exactly sure how long the series will run. It certainly will be quite a while, though. A word of warning: my school schedule is completely insane from the start and I will not be publishing largely on a weekly basis like the first series. Instead, I'll be posting them when I am able. I really like writing these things, so they'll happen, but it may take some time. Now, without further adieu, Lesson 1, which starts by looking at templates and some of the containers in the Standard Template Library.
The direction of the series is pretty straightforward. First, we'll be spending some time (i.e. the first unit) delving into some less-commonly-used features of C++ which show up in Haiku from time to time. This is partly to bring up to speed those who are picking up the series after finishing the first one, but also to examine ways that features like containers from the Standard Template Library can be effectively used in combination with the Haiku API. There's even a quick primer on source control thrown in for good measure -- something which any developer should at least understand, if not use religiously. Following the first unit we will dig into the API. Depending on how things work out, there may or may not also be a crash course on GUI programming in there before diving into the kits themselves. Some of the lessons will deal directly with getting to know a particular kit. Others will examine important topics or the "Haiku way" of getting a task done. They should provide a good working knowledge of Haiku development methods that can easily be expanded into more advanced usage.
Lesson #2 in my new series of development tutorials continues with a fast and furious course through the rest of the Standard Template Library with some of the Standard C++ library thrown in for spice. We learn about associative STL containers like map and set and examine the C++ string class.
Lesson 3 introduces C++ file streams, formatting and printing using C++ streams, and lightly touches on exceptions.
Lesson 4: Source Control
Lesson 4 takes a break from actual coding and spends time on a critical development tool: source control -- what it is, how it is used, and why it is used.
Lesson 5 ties together all of the C++ concepts covered in this series with a project.
Lesson 6: ....
You might think that I took a short vacation, but I've just been buried in Real Life. You might also be wondering about where lessons 6-11 went. They'll be published later, but you're not missing anything, as they are edits of the last several lessons from Learning to Program with Haiku with an experienced developer in mind. If you've worked with the previous series, there isn't anything in 6-11 that you haven't seen before -- they're more to make the Programming with Haiku series complete on its own.
Lesson 12: All About Attributes
This lesson is all about attributes -- what they are, how they can be useful, and how they are manipulated from code.
Lucky Lesson 13: Queries
I'm not talking about databases, either. In this lesson, we examine one of the most distinctive features Haiku has: the query. We get a good, long look into the murky depths that are the query's official syntax, Reverse Polish Notation, and a few other weird and wonderful tricks. Enjoy!
Lesson 14: I Node What You Did Last Summer
A holiday treat! In this lesson we continue to work our way through the Storage Kit, learning about one of the lesser-known features of the Haiku API: node monitoring. For those new to Haiku, it notifies programs of changes to the filesystem, such as changes in a name, etc. If you're looking to turn a good Haiku app into a fine one, this is one way to do it.
Lesson 15: Making a New File Type
Depending on what kind of projects you write, you may have to create a new file type from time to time, such as a document type for the next Word-killing word processor. While not difficult, making one needs a bit of knowledge from different places in the OS and the API. In our final lesson which focuses on the Storage Kit, we will learn about MIME types, how to show the OS how to automatically identify files of your new type, and more.
Lesson 16: Fonts
Most people think of fonts as merely a means to an end, but in this lesson we will take a crash course in typography and the very basics of displaying text in Haiku.
Unit Review: 6 - 15
Now a review of the second unit, lessons 6 through 15.
Lesson 17: Writing a New Control, Part I
This lesson is one of several which delves into the art of control writing for Haiku -- not just a quick-and-dirty hack on an existing one, but writing a new control which rivals existing ones in quality and features. Learn how controls handle drawing themselves and write a basic color display control.
Lesson 18: Application Scripting
What is today's topic? Scripting Haiku applications, possibly one of the least understood aspects of the operating system. Learn about hey command, its uses, and even see some of the most English-like bash commands ever. Also see how to make almost any Haiku application answer your beck and call and tinker around the operating system with an updated version of the ScriptWorld demo application, Scripting Explorer.
Lesson 19: Deeper in Application Scripting
When we last looked at application scripting in Haiku, we merely scratched the surface. Using the hey command and the basic concepts behind the Haiku scripting model, we were able manipulate running applications to do our bidding. Now we will delve into the C++ code which can do the same thing with much greater flexibility and even implement scripting support in our own GUI controls.
Lesson 20: Drag and Drop
In this lesson we seek to understand the part of the Interface Kit which lets us move things around in Tracker using the mouse. We will examine both ways of transferring information from one program to another, both the simple way and the more flexible (and complicated) method.
Lesson 21: Replicants
Here is a topic that for the longest time as a BeOS/Haiku developer, I had no idea how to do and didn't really feel enthused on the concept of learning. Of course, now all the major platforms have desktop gadgets. Ironically, writing a replicant is really easy if you already know how to write basic Haiku GUI applications already. Find out how in this lesson.
Lesson 22: A First (Bigger) Project
Lesson 22 begins a project which will delve deeper into what is involved in developing larger projects in Haiku. In this case, we begin working on a text editor, QuickEdit.
Lesson 23: ...... again
This book is still yet to be finished.
If you have enjoyed it and learned a lot, make sure to encourage me by telling me what you think of it so far by contacting me.