[HN Gopher] Learning to Program with Haiku
       ___________________________________________________________________
        
       Learning to Program with Haiku
        
       Author : nivethan
       Score  : 210 points
       Date   : 2025-04-10 03:41 UTC (19 hours ago)
        
 (HTM) web link (www.haiku-os.org)
 (TXT) w3m dump (www.haiku-os.org)
        
       | dddw wrote:
       | There is so much love and attention to Haikus
        
       | DeathArrow wrote:
       | The tutorial is from 2010. At the time people were much more
       | enthusiastic about Haiku and other alternative operating systems.
       | 
       | Now we only have Windows and Unix like.
       | 
       | I still wonder what would have happened had Jean-Louis Gassee
       | been less greedy and Apple acquired BeOs instead of Next.
       | 
       | I discovered BeOs in 2000 and it seemed to me much more
       | interesting at that moment than either Windows or Linux. Not only
       | it looked and felt better but it introduced other ideas and
       | concepts.
       | 
       | I had hopes it's adoption will increase but it soon withered and
       | died.
       | 
       | I still wonder why we can't do better than Unix and Windows. Unix
       | is 50 years old and Windows is old, too. There should be better
       | concepts out there waiting to be discovered and implemented.
       | 
       | At some point there were many companies, universities, groups and
       | individuals involved in researching and implementing operating
       | systems.
       | 
       | At that point I was following OsNews website daily and each day
       | there were news about some new and exciting developments.
       | 
       | Not anymore.
       | 
       | I miss the days when I read about BeOS, Syllable, AROS, MorphOS,
       | AtheOS, SkyOS, Plan 9, Inferno, Singularity. And there were a ton
       | of interesting kernels, too.
        
         | erremerre wrote:
         | I think the main issue is... hardware.
         | 
         | There is a reason why I have 0 problems using linux on a
         | raspberry PI, yet everytime I try to install in a real computer
         | I got lying around I got a myriad of nosense problems which are
         | particularly hard to solve.
         | 
         | If we want a new OS we need to make it for certain platform
         | which is always identical in terms of hardware. I would say a
         | PS3, Steam Deck, or Nintendo Switch would be good candidates.
         | 
         | They have plenty of identical hardware units in the market, and
         | you could focus on the OS rather than supporting strange
         | hardware issues.
         | 
         | You missed my favourite from the list: ReactOS
        
           | desdenova wrote:
           | Drivers are precisely the reason we only have Windows, Macos
           | and Linux as viable options.
           | 
           | Hardware manufacturers write Windows drivers, Linux community
           | write drivers for basically all consumer hardware, and apple
           | develops both the hardware and the OS with their own drivers.
        
             | DeathArrow wrote:
             | >Drivers are precisely the reason we only have Windows,
             | Macos and Linux as viable options
             | 
             | That is one big issue and another one is software.
             | 
             | Writing drivers and porting software means both time and
             | money.
             | 
             | How ever if a new OS would bring lots of benefits to both
             | users and companies, it might tip the scale and make the
             | time and money investment worthwhile.
             | 
             | Of course, by a new OS I don't mean just another platform
             | that ebables us to run software and use hardware, as
             | existing OSes do that just fine.
             | 
             | By a new operating system, I mean one that enables us to
             | use new computing paradigm, enable new types of software to
             | software and software to hardware interactions and would
             | make a big disruption to the market. Something with the
             | same kind of impact as AI or the introduction of
             | smartphones.
        
               | actionfromafar wrote:
               | Everything is so fluid nowadays. Even if use-case was
               | found, someone would find a way to run Linux on it.
        
               | whywhywhywhy wrote:
               | Yeah but finding a way to run it is having a hobby of
               | debugging software and work arounds on top of your job.
        
         | flohofwoe wrote:
         | > I still wonder what would have happened had Jean-Louis Gassee
         | been less greedy and Apple acquired BeOs instead of Next.
         | 
         | Nothing different would have happened. You would have used C++
         | instead of Objective-C to write macOS UI programs, but other
         | then that macOS would be in the same shitty state it as is
         | today (assuming a wildly popular iPhone would also have
         | happened in that alternative timeline and take the focus away
         | from desktop UI development).
         | 
         | One thing might probably be different: macOS might be less
         | popular amongst developers because BeOS wasn't a UNIX clone
         | (but 'Linux on the desktop' might actually be in a better
         | state).
        
           | b800h wrote:
           | Yes, this - OS X wouldn't have become a near-ubiquitous
           | developer desktop. That would have been very bad for Apple.
        
             | graemep wrote:
             | Really? Most users I have come across are not developers. A
             | high proportion of developers use it, but the proportion of
             | users who are developrrs is quire low.
        
               | cbzbc wrote:
               | I think you'd have got a much smaller eco-system of third
               | party apps for MacOS (think omnigraffle etc). Whether
               | that would have made a substantive difference I can't
               | say.
        
               | actionfromafar wrote:
               | Developers drive adoption (not least by creating
               | software) and high specs.
        
               | graemep wrote:
               | Yes, but those developing for Apple OSes would have
               | adopted whatever OS Apple used.
               | 
               | The developer who pick it because it is a Unix are people
               | who developer for Unix like OSes, mostly for servers, so
               | they mostly do not produce software that drives adoption
               | by people who are not developers.
        
               | actionfromafar wrote:
               | This is true. Only upside I can see is that the developer
               | tools available for "unix-ish" system were really strong
               | (if clunky at times).
        
               | bigstrat2003 wrote:
               | I don't even think it's true that a high proportion of
               | developers use Macs. My guess would be that most
               | developers use Windows, because most developers work for
               | corporations and most corporations issue Windows machines
               | to all employees. Companies which offer a choice are in
               | the minority.
        
             | anthk wrote:
             | The rest of the world doesn't use OSX for all.
        
           | z3phyr wrote:
           | Most of the developers of the microcomputer revolution era
           | programmed in Non-Unix environments.
           | 
           | Even in workstation space, the cool lisp/smalltalk/...
           | developers hated unix, but the small market was filled with
           | unixes.
           | 
           | Even today, most of the native developers use windows!
        
           | os2warpman wrote:
           | >I still wonder what would have happened had Jean-Louis
           | Gassee been less greedy and Apple acquired BeOs instead of
           | Next
           | 
           | Internal efforts to get BeOS's security levels up to even Mac
           | OS 9 levels would have bankrupted 1997 Apple.
        
         | kitd wrote:
         | OS/2 was created by the biggest computer company in the world
         | at the time, yet even it couldn't get enough traction.
         | 
         | In the world of OSes, "the same as what everyone else is using"
         | is much more important than "new takes on old concepts".
        
           | piokoch wrote:
           | It came a few years to early. I remember my shock when I get
           | [1] my OS/2 copy and it was on 10 (yes, ten!) 3.5 inch Floppy
           | Disk, while Windows needed two (one for main OS, one for some
           | utilities).
           | 
           | [1] This was 1987 still communistic Poland, so I bought a
           | pirated copy on a famous Warsaw computer bazaar on Grzybowska
           | street.
        
             | sixothree wrote:
             | Agreed. Their timing was not right. But once Windows 95
             | hit, it was over. Also, the RAM requirements made it pretty
             | much impossible for people to recommend to their friends
             | and family.
             | 
             | I really had a special fondness for OS/2. But using it
             | today, it really is a quirky thing. Maybe if it had won I
             | wouldn't be thinking that way.
        
           | pjmlp wrote:
           | Of course, when it was more expensive than MS-DOS 5/Windows
           | 3.1 combo hardware requirements, what to expect.
           | 
           | In today's money, going with OS/2 instead would have cost me
           | 1000 euros more when I bought my 386 PC.
        
         | terhechte wrote:
         | Just wanted to say that I was only someone who read OsNews
         | daily back somewhere from 2002 to 2007 or 2008. So many
         | interesting things going on.
         | 
         | With the proliferation of web apps and containers, alternative
         | operating systems are actually more feasible today. At the same
         | time, I'm dependent on all the niceties that the macOS/iOS
         | ecosystem offers (the integration, the sync). Something I
         | wanted to look into is just running macOS in a very default way
         | and then using a fast OS (such as Haiku, though their Arm64
         | support is not very good yet) in a fullscreen VM. With modern
         | Apple Silicon, there's almost no performance penalty.
        
         | pjmlp wrote:
         | iDevices and Android are not Unix like, there is hardly any way
         | to do an usable application with POSIX APIs.
         | 
         | Same applies to cloud computing with language runtimes and
         | serverless.
         | 
         | While it looks grim, there are some hopes for OS lovers.
        
         | anthk wrote:
         | Risc OS it's still alive, it works great under an RPI B+ and
         | up. Just get some industrial graded SD.
         | 
         | I suggest you to get the Risc OS Direct 'distro' and then the
         | update which has wireless support. Read the documentation
         | first, of course.
         | 
         | Risc OS it's very similar to Windows in usage (more like an
         | Amiga), once you read the docs you will get it ready in no
         | time. You have the old Netsurf browser on its native plataform,
         | it's fun.
         | 
         | On plan9, 9front superseded it.
        
         | WillAdams wrote:
         | I'm faintly surprised that the Raspberry Pi hasn't made OS-
         | experimentation more of a thing.
         | 
         | There are:
         | 
         | https://www.raspberrypi.com/news/risc-os-for-raspberry-pi/
         | 
         | https://wiki.sugarlabs.org/go/Installation
         | 
         | https://9p.io/wiki/plan9/Raspberry_Pi/index.html
         | 
         | as well as a couple of RTOS options: https://all3dp.com/2/rtos-
         | raspberry-pi-real-time-os/ and QNX: https://pidora.ca/qnx-on-
         | raspberry-pi-the-professional-grade...
         | 
         | and TRON: https://www.tron.org/blog/2023/09/post-1767/ (but
         | that's only on the Pico? I'd love to see it as a desktop OS on
         | an rPi5)
        
           | MisterTea wrote:
           | To add for Plan 9: https://9front.org/releases/
           | 
           | Maintained daily. pi is 32bit and pi3 is 64bit. WiFi works.
        
         | MisterTea wrote:
         | > I still wonder why we can't do better than Unix and Windows.
         | Unix is 50 years old and Windows is old, too. There should be
         | better concepts out there waiting to be discovered and
         | implemented.
         | 
         | Plan 9. It's a Unix built on top of a network. Each process can
         | be thought of as a container as each gets a namespace which
         | consists of a table of mounts and binds of resources. Those
         | resources are served by an architecture neutral RPC protocol
         | which serves a tree of objects we call files: 9P. The server of
         | these resources is called a file server and is akin to a micro-
         | service that runs bare metal on the CPU, the kernel is the
         | container host. These resources are protected by Unix
         | permissions verified by the kernel against a security service
         | called factotum, itself a 9P server. Cloud ready, bare metal
         | micro-service computing started in the late 80's and nobody
         | noticed.
         | 
         | > I miss the days ... Plan 9, Inferno, ...
         | 
         | Still alive and kicking. Head over to 9front.org for a
         | maintained fork of each. Patches arrive nearly daily to 9front
         | and the community is encouraged to contribute. 9front also runs
         | my home network because setting up DHCP, DNS and TFTP for PXE
         | is dumb simple.
        
         | ForHackernews wrote:
         | There is still new exciting stuff happening
         | 
         | https://serenityos.org/
         | 
         | https://collapseos.org/
         | 
         | http://kolibrios.org/en/
        
         | 7thaccount wrote:
         | I too long for different ways of interacting with a computer.
         | 
         | Unfortunately, I think the ship may have sailed as it's getting
         | too hard to both start from scratch and also provide support
         | for everything from a web browser to drivers and so on. It was
         | a lot easier when the to do list was 1/100th the size. The
         | workaround is to utilize what has already been done, but then
         | that kind of defeats the entire purpose and you just get a
         | slightly different flavor of the same thing.
         | 
         | The only other real option would be a radical revision of what
         | a computer is. Something really simple that maybe a bit closer
         | to what Carl Sasserath was doing with iOS (no, not Apple iOS,
         | but the internet OS via Rebol thing) iirc, or what the Forth
         | folks do with hardware. I think Alan Kay may have talked about
         | this as well from a smalltalk perspective. The question is if
         | you can do anything interesting with it. I'm sure there are
         | dozens of us that would give up YouTube and social media to
         | have a fully understandable computing system :)
        
         | Kon5ole wrote:
         | >I still wonder what would have happened had Jean-Louis Gassee
         | been less greedy and Apple acquired BeOs instead of Next.
         | 
         | I'm pretty sure Apple would have been bankrupt a few months
         | later if they didn't buy back Steve.
        
       | interroboink wrote:
       | Somewhat tangential: this reminded me of Neal Stephenson's "In
       | the Beginning was the Command Line" [1] which speaks highly of
       | BeOS.
       | 
       | I liked the bug report "R4: BeOS missing megalomaniacal
       | figurehead to harness and focus developer rage" (:
       | 
       | [1] https://web.stanford.edu/class/cs81n/command.txt
        
         | troyvit wrote:
         | Man I read that during my formative years as a computer guy and
         | it helped me big-time make the switch from MacOS to Linux. That
         | and "The Cathedral and the Bazaar."[1] I don't know how well
         | that one stands up to the test of time though. I'm going to re-
         | read your link now.
         | 
         | http://www.catb.org/~esr/writings/cathedral-bazaar/cathedral...
        
           | ameliaquining wrote:
           | The most immediately obvious answer to that question, shared
           | by Stephenson himself, is that the essay quickly failed the
           | test of time because it did not anticipate Mac OS X, which
           | breaks the dichotomy of user-friendly-but-anemic Classic Mac
           | OS vs. powerful-but-forbidding Unix.
           | 
           | (I personally still don't really like Apple systems and don't
           | use them, but I think it's clear that _by the standards of
           | the time_ OS X squared this circle.)
        
       | Aldipower wrote:
       | This a a great tutorial! Very easy to read and understand. If
       | someone would like to dive into C programming I would suggest
       | this.
        
         | 10729287 wrote:
         | That's exactly what I wanted to read and was about to ask. I
         | always wanted to both contribute to FOSS beyond helping with
         | translation and to learn coding. That seems to be the perfect
         | opportunity to check those two boxes as I've got a lot of
         | sympathy for the Haiku os.
        
         | sverhagen wrote:
         | Kindly disagree. You are either an experienced programmer, in
         | which case this starts off way too basic, or you are coming
         | into programming for the first time, in which case: why would
         | an average person start with C++ or whatever Haiku is?!
        
           | Aldipower wrote:
           | Nope, if you read carefully, I've wrote "dive into C
           | programming". This does not target first time programmers.
           | But this doesn't mean you are an experienced programmer
           | already. Fair enough, I've meant C++, not C. :-) I think this
           | tutorial is perfect for kind of beginners, but not complete
           | novices of course.
        
       | ktallett wrote:
       | This was how I relearned to program in C++ and ported a few apps
       | to the OS. It was a great experience and the OS has come on leaps
       | and bounds. If anything for many it could be a daily driver
       | nowadays.
        
       | tialaramex wrote:
       | Because Haiku has taken such an extraordinarily long time, as
       | with a city centre that was constructed over multiple centuries
       | we can see the clear lines of new work with new techniques and
       | materials on top of old work done in a way that was usual at the
       | time.
       | 
       | Haiku has a _lot_ of C++ 98 code or even pre-standard C++, not
       | least all the stuff re-used with permission from BeOS. As was
       | usual for projects at that time many fundamental building blocks
       | are provided rather than using a language standard. For example
       | there 's BString and BList.
       | 
       | Haiku also has seams of BSD code where there'd be a project to do
       | Whatever (WiFi, TLS, drivers, etc.) "properly" in a way unique to
       | Haiku but as a stop gap here's some BSD code until we finish our
       | own proper solution, which of course never happens.
        
         | waddlesplash wrote:
         | > with new techniques and materials on top of old work done in
         | a way that was usual at the time.
         | 
         | But is there any long-lived project for which this isn't true?
         | Linux and the BSDs surely have many components that fall into
         | this category.
         | 
         | > For example there's BString and BList.
         | 
         | BString is a much nicer string class to work with (IMO) than
         | std::string. It lacks some modern conveniences, and it has some
         | unfortunate footguns where some APIs return bytes and some
         | return UTF-8 characters (the former should probably all be
         | considered deprecated, indeed that's a BeOS holdover), but I
         | don't think there's any intent to drop it.
         | 
         | BList could be better as well, but it's still a nicer API in
         | many ways than std::vector. Our other homegrown template
         | classes also are nicer or have particular semantics we want
         | that the STL classes don't, so I don't think we'd ever drop
         | them.
         | 
         | > Haiku also has seams of BSD code where there'd be a project
         | to do Whatever (WiFi, TLS, drivers, etc.) "properly" in a way
         | unique to Haiku
         | 
         | What would be the point of implementing WiFi drivers from
         | scratch "uniquely" for Haiku? Even FreeBSD has started just
         | copying drivers from Linux, so that may be in our future as
         | well. I don't know that anyone ever really considered writing a
         | whole 802.11 stack for Haiku; there was some work on a "native"
         | driver or two at one point, but it was for hardware that we
         | didn't have support for from the BSDs, and it still used the
         | BSD 802.11 stack. Writing our own drivers there just seems like
         | a waste of time; we might as well contribute to the BSD ones
         | instead.
        
           | tialaramex wrote:
           | > But is there any long-lived project for which this isn't
           | true?
           | 
           | I don't think any other project like this exists. You're
           | coming up on your 25th anniversary without shipping the
           | release software !
           | 
           | I see that BString itself also uses this weird phrase "UTF-8
           | character". That's not a thing, and rather than just being
           | technically wrong it's so weird I can't tell what the people
           | who made it thought they meant or what the practical
           | consequences might be.
           | 
           | I mean, it can't be worse than std::string in one sense
           | because hey at least it picked... something. But if I can't
           | figure out what that is maybe it's not better.
           | 
           | UTF-8 has code units, but they're one byte, so distinguishing
           | them from bytes means either you're being weird about what a
           | "byte" is or more likely you don't mean code units.
           | 
           | Unicode has characters, but well lets quote their glossary:
           | "(1) The smallest component of written language that has
           | semantic value; refers to the abstract meaning and/or shape,
           | rather than a specific shape (see also glyph), though in code
           | tables some form of visual representation is essential for
           | the reader's understanding. (2) Synonym for abstract
           | character. (3) The basic unit of encoding for the Unicode
           | character encoding. (4) The English name for the ideographic
           | written elements of Chinese origin. [See ideograph (2).]"
           | 
           | So given BString is software it's probably working in terms
           | of something concrete. My best guesses (plural, like I said,
           | I'm not sure and I'm not even sure the author realised they
           | needed to decide):
           | 
           | 1. UTF16 code units. This is the natural evolution of
           | software intended for UCS-2 in a world where that's not a
           | thing, our world.
           | 
           | 2. Unicode code points. If you were stubbornly determined to
           | keep doing the same thing despite the fact UCS2 didn't
           | happen, you might get here, which is tragic
           | 
           | 3. Unicode scalar values. Arguably useful, although in an
           | intensely abstract way, the closest thing a bare metal
           | language might attempt as a "character"
           | 
           | 4. Graphemes. Humans think these are a reasonable way to cut
           | up written language, which is a shame because machines can't
           | necessarily figure out what is or is not a grapheme. But
           | maybe the software tries to do this? There have been better
           | and worse attempts.
           | 
           | I don't love std::vector but I can't see anything to
           | recommend BList at all, it's all using type erased pointers,
           | it doesn't have the correct reservation API, it provides its
           | own weird sorting - which doesn't even say whether it's a
           | stable sort,
        
             | GoblinSlayer wrote:
             | I suppose it means text encoding is known to be UTF-8.
        
       | revskill wrote:
       | But i already know how to program, then why do i need Haiku ?
        
       | Hj8Rd2Qw wrote:
       | Haiku's approach to teaching programming is refreshing - starting
       | with real-world GUI apps right away rather than console
       | exercises. Their simple API design makes this possible while
       | still conveying fundamental concepts through tangible, visual
       | results. A great example of how OS architecture can influence
       | learning outcomes.
        
       | codr7 wrote:
       | I was really into BeOS for a few years, right around the Intel
       | pivot.
       | 
       | Very nice OS, but I remember the programming API to be tricky
       | since everything was multi-threaded.
        
       ___________________________________________________________________
       (page generated 2025-04-10 23:01 UTC)