Learning to Program with Haiku

Lessons by DarkWyrm

Learning to Program with Haiku
ISBN: 978-0-557-53969-7 (lulu.com)

In January of 2010, I started publishing lessons on learning to program for Haiku, aimed at people who want to be able to write simple programs to get stuff done, but never had anyone around teach them. Years ago, I started teaching myself and am an active developer. It's my turn to give back.

All of these lessons are distributed under a Creative Commons license which allows free distribution for noncommercial purposes. Should you have questions, by all means contact me.

If you're a fan of the lessons and want to show appreciation or to have a copy of it on your desk while you work your way through, now you have a chance to have a high quality copy, and if you've been sitting on the fence about it, read a lesson or two and then decide for yourself. A hard copy of all of these lessons, compiled and further polished, can be found at the link below. Enjoy!

Learning to Program with Haiku at Lulu.com

Lesson 1

Have you ever wanted to learn to program for Haiku (or something else) but never had the money or the chance? Has something else gotten in the way? This is quite an opportunity for someone who wants to learn to code. To kick things off, here's the first one.

Download PDF
Download PDF
Comments
View Comments




Lesson 2

Download PDF
Download PDF
View Comments
View Comments




Lesson 3

In this lesson, we examine the different types of data we can use, a more in-depth look at how to print to the screen, and more!

Download PDF
Download PDF
View Comments
View Comments




Lesson 4: If, For, And, Not, Or

Decision-making and repeating instructions are on the agenda for this one, expanding the repetoire of basic skills for writing code.

Download PDF
Download PDF
View Comments
View Comments




Lesson 5: Arrays, Strings, and Pointers

This lesson marks the end of the first unit and is somewhere around halfway from complete neophyte to writing -- and understanding -- our first program for Haiku which uses windows and buttons.

Download PDF
Download PDF
View Comments
View Comments




Unit Review: 1 - 5

Download PDF
Download PDF
View Comments
View Comments




Lesson 6: More Loops and Conditions

Here marks the beginning of the second unit in my series, "Learning to Program With Haiku." Lesson #6 expands on our knowledge of loops and decision-making constructs.

Download PDF
Download PDF
View Comments
View Comments




Lesson 7: Losing My Memory

This one covers two major topics: memory management and binary math, nothing terribly exciting, but really useful and necessary nonetheless

Download PDF
Download PDF
View Comments
View Comments




Lesson 8

Download PDF
Download PDF
View Comments
View Comments




Lesson 9

Download PDF
Download PDF
View Comments
View Comments




Unit Review: 6 - 9

Download PDF
Download PDF
View Comments
View Comments
Review Answers
Review Answers




Lesson 10: More Pointers and the Command Line

Now we're starting to tie up loose ends before moving on to just C++. In this lesson, we learn more about pointers and kinda-sorta pointers called references, and we examine the basics of getting information from the command line.

Download PDF
Download PDF
View Comments
View Comments




Lesson 11: More Data Structures and Types

This time around, we will be examining some important kinds of data structures and ways to create custom data types, a critical stepping stone in getting to understanding the Haiku API. This is the last C / C++ lesson -- the rest will be C++ only. A couple more lessons and we'll finally be ready to write GUI programs for Haiku!

Download PDF
Download PDF
View Comments
View Comments




Lesson 12: OOPs I Did It Again!

This lesson introduces us to the wonderful world of C++ and Object Oriented Programming. It's not terribly code-heavy, so this might be a good time to look over past lessons to make sure you understand concepts pretty well -- it only gets bigger from here. :-)

Download PDF
Download PDF
View Comments
View Comments




Lesson 13: Programming With Class(es)

Today we'll be diving headlong into the murky depths of C++ programming: classes and inheritance -- struct's with fancy tricks aplenty. It's also our last lesson before writing our first windowed Haiku program, so get ready and study well. Enjoy!

Download PDF
Download PDF
View Comments
View Comments




Unit Review: 10 - 13

Download PDF
Download PDF
View Comments
View Comments
Review Answers
Review Answers




Lesson 14: Our First GUI Program

It's about time: our first program which does more than print stuff to the Terminal! Now the real fun begins!

Download PDF
Download PDF
View Comments
View Comments




Lesson 15: The Haiku API at 10,000 Feet

Lesson 15 delves further into what writing basic applications are all about, looking at the API and its organization and focusing on an essential: messaging. Also included in this lesson are the finished sources for those who don't want to mess around with typing the project out.

Download PDF
Download PDF
Download Source Code
Download
Source Code
View Comments
View Comments




Lesson 16: Locked and Overloaded

This lesson takes a break from hacking the Haiku API to learn a few C++ language concepts needed to continue progress as an aspiring developer. Function overloading and operator overloading are examined in detail.

Download PDF
Download PDF
View Comments
View Comments




Lesson 17: What's on the Menu

We are back to learning about hacking on the Haiku GUI after taking a short C++ language break. Today's topic? Menus. Also in this lesson is some expansion of what we know about messaging and BViews.

Download PDF
Download PDF
Download Source Code
Download
Source Code
View Comments
View Comments




Lesson 18: Working With Lists

We're starting to get closer to the end of this Learning to Program series. After toying with menus and interface colors in the last lesson, we apply some of the concepts used with menus to get the hang of using list boxes and discover along the way a few bizarre sports that really exist. Games people play. Sheesh.

Download PDF
Download PDF
Download Source Code
Download
Source Code
View Comments
View Comments




Lesson 19: Resources and Pictures

Ten years ago when I first started to learn to write code using BeOS, I had a lot of questions that I couldn't any documentation to give me the answers. Luckily, there was the Be Code Talk mailing list and kindhearted members of the community, like David Sowsy (Animaxo, Vesa Accepted). Resources are one of those things that eluded me. Eventually I figured them out, but Lesson 19 lays some of it out in plain conversation.

Download PDF
Download PDF
Download Source Code
Download
Source Code
View Comments
View Comments




Lesson 20: All About Storage

Moving on from exploring the Interface Kit, we turn our attention to the Storage Kit in this lesson. We take a look at the kit from a broad perspective and also begin using some of its many of the classes. We take a break from writing GUI applications and, instead, write a console directory-listing program using C++.

Download PDF
Download PDF
Download Source Code
Download
Source Code
View Comments
View Comments




Lesson 21: Reading and Writing Files

This lesson continues with delving into the Storage Kit, reading and writing files. We also start writing code for the final project of the Learning to Program With Haiku series which will be developed over the course of several lessons.

Download PDF
Download PDF
View Comments
View Comments




Lesson 22: Designing a GUI

Usability is one of my pet topics. Although less so now that in years past, it is all-too-often ignored or not given enough priority. This lesson scratches the surface from a developer's point of view. I'm no usability expert, but I do know a thing or two. This lesson is a must-read for any budding developer, and by the end of it, we will have a good real-world program to show off which is just shy of being ready for a release.

Download PDF
Download PDF
Download Source Code
Download
Source Code
View Comments
View Comments




Lesson 23: Polish and Packaging Our Project

This lesson finishes up the project that the last two have been about: HaikuFortune, a program which randomly chooses and displays a fortune in a window. It's not a very complicated one, but it exemplifies a reasonably well-coded real-world project. Although it was code complete as of the end of Lesson 22, it was not finished, missing icons and other resources. This concludes the project with adding resources, a basic discussion on source code licensing, and packaging a program for Haiku.

Download PDF
Download PDF
View Comments
View Comments




Conclusion

This also concludes the Learning to Program With Haiku lesson series. It's been a good run. Rest assured, though, that this is not the last lesson on Haiku programming that I will write. This series has been intended to turn a motivated power user into a developer using Haiku. It's been a lot of fun and many people have encouraged me with their kind words regarding it.

Later this summer I will start another yet-to-b e-named series which will continue where Learning to Program With Haiku is leaving off and introduce novice and intermediate developers to real coding specifically for Haiku and its nuances, such as multithreaded programming, add-on coding, queries and attributes, Tracker and more.