jonas hvid

Programming, just for fun

Programming is fun. Computers have an exciting, almost magical quality to them. Sitting down, typing out a program, and then seeing those symbols come to life at your command – it just feels good.

Sadly, it's becoming harder and harder to actually have this experience. As personal computers have become ubiquitous, they have also become increasingly impersonal. But this same ubiquity is also why there are now more people than ever trying to bring the magic back to computers. In this article, I want to give you a brief tour of some of my favorite projects that demonstrate just how much fun computers can be.

Let's start with PICO-8. This is a so-called fantasy console – an emulator for a Commodore 64-era computer that never existed. It's a simple idea: Just boot it up, and start typing in commands from the manual. And the execution is great. It's easily worth the $15, but there are also open-source alternatives like TIC-80.

PICO-8 uses Lua and comes with editors for sprites, sound effects, music and maps.

I've been enjoying my time with PICO-8. It brings back the experience that got me hooked on programming in the first place. The fact that you can just write commands and immediately see something on the screen is exciting.

Of course there is more to programming than just typing commands. Software development is at its core about designing systems that are more than the sum of their parts. It's about putting together a bunch of small components, and watching them grow into something actually useful.

That's what I love about Pharo. Pharo is a living descendant of the legenday Smalltalk-80 system. Describing it as a programming language would be inadequate – it's more like a whole world inside a computer.

After opening up Pharo, you see an OS-like interface. From there, you can explore the code that runs Pharo itself. You can edit anything, and see your edits take effect immediately. What makes Pharo unique is that you don't exactly write programs in Pharo. When you want to add some new behavior, you just take the live system and add some new classes and objects.

Pharo lets you edit every part of the system as it's running.

Pharo is expansive. It has out-of-the-box version control, multiple GUI frameworks, a HTTP server, and much more. But it somehow still manages to feel cozy. The fact that you can just open up anything and immediatly see how it works makes the whole system approachable, in spite of its complexity. And the fact that you can see the effects of your code as you're writing it, gives it the same tangibility and excitement that you can get from something like PICO-8.

Even spending a few weekends with Pharo has permanently enriched my appreciation for programming in general and object-oriented programming in particular. I recommend diving right in, but the talk But Really, You Should Learn Smalltalk by Noel Rappin is a good introduction too.

After working within immersive environments like PICO-8 and Pharo, it's natural to want to know how they work. For a long time, the idea of creating my own programming language was something of a fantasy for me. But it's actually not that difficult – and that's true even if you insist on doing everything from scratch.

Jonesforth is a complete implementation of the Forth programming language in just a couple thousand lines of thoroughly commented assembly code. When I found out about Jonesforth, I decided to make my own implementation, targeting UEFI. Now I can boot up a computer straight into my very own programming environment, built directly in assembly.

Screenshot from my own Jonesforth-based Forth environment on UEFI, called Jonasforth.

The end result is not especially impressive. I got to the point where you could draw a blue square on the screen and then called it a day. But building this thing out of nothing was such a satisfying experience.

For the next level, check out Andreas Kling's YouTube channel. He's writing an entire operating system in C++, and documenting the process. It's called SerenityOS, and his videos about it show how much work goes into building an operating system – but also demonstrate that such a feat is remarkably achievable.

SerenityOS is described as "a love letter to '90s user interfaces with a custom Unix-like core".

Finally, I have to recommend Ben Eater's video series in which he builds his own computer on a breadboard. It's a must watch, even if you're not planning to follow along yourself. He has a way of making everything seem so simple that it becomes almost obvious, while still conveying just how amazing computers actually are.

This is a real CPU, built from scratch using basic components.

I've been programming since I was a child. Back then, computers felt magical. Ben Eater's YouTube series has brought back that magic – paradoxically by demystifying their inner workings.

It's so easy to get caught up in the loop of constantly trying to become more productive, more efficient, more knowledgable. But if you want to enjoy programming, there's something to be said for giving yourself the freedom to build something just for fun.

There is a value in cultivating appreciation for the creative process. You can teach yourself to enjoy creating something for its own sake. In the long term, this is a far more useful skill than any technical knowledge you can find in books or memorize by forcing yourself to slog through artificial coding exercises.

Instead of learning the latest web framework, why not spend some time doing some electronics, or writing a game, or just messing around with a Smalltalk system? Challenge yourself to create something. Make it unoriginal, useless and unfinished. Try programming, just for fun.