diving into assembly language

10 Nov 2015 . tech . Comments #assembly #low-level #programming #1337 #polyglot #apis #history

As of late, I have discovered a bit of a fear of mine: I am terrified of C, or any low-level language, for that matter.

I mean, the idea that my code may become unintelligible if I don’t send a null terminator doesn’t sound too fun to me. To illustrate why this scares me, let me give you a bit of my background.

I started programming in 2011 while I worked as a tech support engineer at Bluehost. I had worked tech support, but I had never attempted learning programming. Sure, in junior high I built a couple crappy websites, but those were only HTML/CSS; I had never tasted the drug that is real programming. I started diving into PHP/Wordpress, and it was a blast. I discovered I adored the act of building something out of nothing. To make a computer bow to my will, even if all it amounted to was “Hello World”. I jumped off the PHP train fairly quickly, and started playing with Javascript, where I fell in love. It was fast, I didn’t need a server, and there were libraries galore to ease me into the hard stuff. I picked up jQuery, moved on to Angular, and once I had my bearings on the frontend, I started learning Node.

It was about this time that I started volunteering. I volunteered for meetup groups, open source projects, anywhere I could get more exposure to server-side work. And it was nice! I/O was a breeze! Express and Passport made building SaaS projects a cinch! I could access databases and files just like I accessed APIs on the frontend! As I dived deeper into garbage collection and memory allocation, I sang praises that Javascript took care of those for me. If I could spend my brain-space on more “worthy” endeavors, why waste my time? Well, then I started learning about memory leaks, and how frustrating they are to debug. While I was praising js for its abstractions, those same abstractions were preventing me from making my code as fast and efficient as I could. As I started looking into lower-level languages to play with, to teach myself more about how things run under the hood, it seemed to be a daunting task. I mean those languages have been around for 30+ years! Old men with larger beards than I can imagine program in those! I could brick my computer with those! They’re too hard to start!

Now, if you’re thinking to yourself, those are stupid reasons to not learn something, you’d be correct. They are stupid reasons. But nonetheless, they are common reasons for avoiding lower-level languages. And I don’t think I’m alone in my rationalizations. It’s easy to think of computers as magic black boxes that just do things for us. It’s daunting to think about what makes that magic box tick. On a more general note, I think it’s easy for newcomers to talk themselves out of learning, even if they’re experienced in other languages. It’s easy to stand on one side of the fence and think, nah, I’m comfortable over here, and not take those first steps into the unknown. We humans, after all, are creatures of comfort, and the unknown that is learning something new is about as far from comfort as we can get. But I think I’ve been doing myself a great disservice in this kind of self-talk, and have decided to make a change.

I’ve decided to dive in head first, and to take on the lowest level language there is, assembly. What I want to do, and what will most likely take a long time to do, is to build an API server with it. That’s right, the same thing I’ve gotten comfortable building in Node, I will now attempt to build using Assembly language. It’ll most likely be for a specific architecture, and won’t be easily transferrable, but I know I need to start somewhere.

If you’d like to see how it’s progressing, feel free to check out the repo where I’ll be keeping the code: learn-assembly-with-apis. If you have any tips or comments on how to build something like this, I can use all the help I can get.

I know few people are reading this blog, but I appreciate you taking the time to. If you’d like to chat with me, feel free to reach out via twitter or IRC on freenode (my handle is therebelrobot).