The Excitement of a New Programming Language
About a year ago, I decided I wanted to know more about all the Rust hype. I read the Rust book, followed a couple tutorials, and read Rust in Action. Somewhere in between all of this, I decided I was ready to write my first CLI notes application on my own with Rust.
Classical music with incredible tavern-like vibes to further embed my RPG analogy
If you are a gamer, starting a new programming language is a bit like starting a new character in an RPG. Everything is exciting at first as you try out your new build. As you get further along, you realize the same things that frustrated you with your previous build start to show up. I’ve come to identify that these “frustrations” are usually mostly boredom. In the context of video games, starting over because you are bored makes a lot of sense. The whole purpose of a video game is to have fun. However in software, starting over is a much bigger deal. In this post, I’ll go over some of the reasons I’ve decided to put Rust (and other languages) on the shelf and instead focus my energy on (re)learning C.
In computers, we often refer to a native language as the language understood by the computer. I’ve recently flipped this around in my ponderings and thought more about what my personal native programming language is.
As a teenager, I babbled around with Java, but this was more parroting exactly what I saw in tutorials. The first language I properly learned was C in first year of my engineering degree. Success in this class seemed almost binary; students either did very well or extremely poorly. This makes sense to me because with programming it either works or it doesn’t. In this class, I learned all the fundamentals of programming and loosely how a computer actually worked. My experience in the class solidified my belief that programming was what I wanted to do and forged a bond with the C language that I didn’t realize until now.
Programming in the Key of C
I recently had a bit of a lightbulb moment of remembering that C can be compiled for the web with emscripten. I have toyed with this in the past, but this time took some time to put together a proof of concept Pong game written in C using the SDL library.
I was a game developer well before I was a web developer and I’ve always found the way a game engine runs to be much more intuitive than a website. I have started experimenting with writing non-game applications with SDL. The first being a GUI terminal like application for note taking. It took me some time to wrap my head around what I needed, but I now have a functional application. I will hopefully soon follow up with a post specifically about this application.
Screenshot taken from iOS
I went a step further with a few extra steps had the same code running on my iPhone 6. The same phone that Apple doesn’t support compiling Swift applications for. After looking up compatibility for SDL, I noticed it is able to run on iOS 6 and greater, meaning it supports iOS devices all the way back to iPhone 3GS. Another win for this method as I can avoid both Swift and Objective-C, while still having better iOS compatibility than most modern “iOS developers.”
On the web development side of things, I have become increasingly frustrated with the options for “installing” a web application. Interacting with the local file system doesn’t really exist, and the concoction of service workers, IndexedDB, etc. to get something to properly work offline is far too complicated. With C, it’s dead simple to read and write files the way that I know and love. Making an offline-only application is the natural default, with online capabilities being added functionality.
In my opinion, web applications should act as a complement to a properly installed application. We are already kind of seeing this with Electron (and others) allowing companies to export their web application (e.g. Slack) as a desktop application. I’m interested in exploring whether working in the opposite direction makes sense. e.g. writing the application in C for the desktop and then making sure that same code is able to run in the browser.
I’m tired of being unable to access my applications without internet. I’m tired of having 3-4 tabs always open. I’m tired of how long it takes to open applications. Our processors have become so much faster, but we have mostly used this as an excuse to write sloppier applications.
For now, this feels like starting a new character all over again. I will probably come out on the other side with a lot of the same feelings about C as other languages. Thankfully, I strongly believe that gaining a better understanding of C is much more valuable than most other languages. C is the foundation on which everything else was built on top of. Maybe I will find the complicated syntax and rules of Rust are worth it. This is a decision I want to be making myself, rather than blindly trusting what happens to be posted on the Internet.
Ultimately, learning is what this is mostly about, but if I happen to come out of this with a new preferred way of writing applications, I wouldn’t complain. I will be following up with code once I’ve cleaned things up a bit. You can subscribe below or follow the engram repository as that is where it will land.