Learning to Program with Haiku
Lessons by DarkWyrm
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!
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.
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!
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.
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.
Unit Review: 1 - 5
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.
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
Unit Review: 6 - 9
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.
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!
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. :-)
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!
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!
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.
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.
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.
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.
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.
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++.