April 23rd Sunday
The Official Rust Logo
Rust has officially become my new favourite language.
Starting from Scratch, moving up to Python, and eventually settling in Javascript has been an exhilarating learning roller coaster in my journey to as a programmer. I stuck with Javascript due to it's promising app and web development use cases, and it's position as a prominent technology that was and is widely used in the software engineering industry. My knowledge of Python also translated well into Javascript given the many similarities between the two, most notably the fact that they are both dynamically typed.
As a result, I have been seldom exposed to low-level systems programming and particularly with more advanced concepts such as memory management which are abstracted from beginner programmers through the use of the garbage collector. However recently, I have become increasingly interested in learning more about lower level languages due my growing appreciation for computer graphics, algorithmic efficiency, and simulations.
This accompanied by an intense desire to return to the resourcefulness and ingenuity of old-school 80's programmers who exploited every ounce of computational power at their disposal to create interesting interactive experiences on their limited hardware is what draws me to these languages. There are countless examples from the early compression algorithms for animation data in the first Crash Bandicoot game to the awe-inspiring inverse square-root algorithm that was revealed in iD Software's Quake III discovered when it was made open source. There are even modern programmers who embody this style of programming: Kaze Emanuar is a youtuber and Mario 64 fanatic who managed to refactor and optimise the entire source code which is written in C to meet modern standards. He is in the process of remastering the game at 60fps and with higher resolution textures on unmodified Nintendo 64 hardware. He even goes as far as to write inline assembly code in some parts to reduce the number of instructions given to the CPU and GPU - optimising the performance to the very microsecond. This is a truly jaw-dropping undertaking and an incredibly motivating example of this type of programming. There is also AngeTheGreat who wrote a physics simulation for engines to create realistic audio effects which has spawned an entire community at the intersection of engineering enthusiasts interested in the unique designs of simulated engines and programmers who use this open source project in their own unique applications.
There was a creativity, I reasoned, that is more prevalent in this style of programming than in the high level programming I'd grown accustomed to. Of course, some of these innovations are not limited by the innate features of the language they are programmed in, and could have been equally implemented and discovered in a higher level language. But these optimisations were only significant because of the intimacy to the metal of the computer and it's ability to truly exploit the computational resources of the system. There's no point coming up with some ingenious innovative algorithm when performance can be vastly increased simply by rewriting the same program in a more efficient language. It's the creative pressure imposed on low-level programmers that pushes them to make the most of their systems in order to meet their performance requirements and which enables this kind of unique optimisation.
As an admirer of beautiful algorithms and the satisfaction that comes with finally watching one's creation come to life - a feeling which I was first exposed to as a young middle-schooler and which I have striven to replicate ever since - I'm inspired to continue pursuing this limitless field of computer science. The first time I successfully ran a program, I was given my first glimpse into the ineffable realm of possibility that the computer enables me to imagine and create. It is the same sense of reverence, like that experienced by a mathematician or physicist, in applying their knowledge to solve a problem that no one else ever has. It is the same bolt of creativity that struck and animated Nikola Tesla as he cracked the secret of the AC motor. As he so aptly puts it, "I do not think there is any thrill that can go through the human heart like that felt by the inventor as he sees some creation of the brain unfolding to success... such emotions make a man forget food, sleep, friends, love, everything." More than anything, I would describe it as a sense of overwhelming freedom to create what I want and how I want to create it.
In a previous blog post The Future of Software, I expressed this sentiment alongside the need to evolve all levels of programming to adapt modern practices learned from the mass adoption of programming and the increase accessibility to this kind of programming that unlocks the potential of the computer. Just as we no longer use floppy disks and CDs as viable hardware solutions, why is it expected that we invest considerable time to learn the antiquated practices of decades old languages such as C/C++ to interact directly with our computers?
Why is it that we as programmers and software engineers are so accustomed to sacrificing performance and years of hardware optimisation? Is there no way to accommodate beginner friendly schemes that accommodate high velocity and prototyping into low level programming instead of choosing to reserve the most performant code for the select few who are willing to invest the time and effort to delve deep into the depths of low-levels system programming?
That is not to undermine beauty and intelligence of languages like Python with their invaluable prototyping and data analysis capabilities. However, it is exactly because these languages have emerged and gained immense popularity that anachronistic features employed by older languages such as linking libraries through CMake files and the cryptic compiler errors in C/C++ - both of which add to the already steep learning curve required to become truly effective at using these languages - need to improve alongside them.
This is especially true when most beginner programmers are indoctrinated into higher level languages which encourage programming practices that will inevitably add to the difficulty of understanding and using these languages in the future. I had an insatiable obsession to understand and learn low-level programming that I could not indulge due to the the barriers to entry and friction that I experienced while trying to learn and use these languages. Each attempt to adopt these languages and develop regularly in these languages resulted in demotivating failure, until eventually I crawled back to my Javascript safe space.
Noticing the unreliability of using these languages to create effective software for various hardware systems in the world, with their uncompromising difficulty which causes memory leaks and crashes in systems as basic as the operating system for an elevator, Graydon Hoare (now angrily trudging up several flights of stairs) recognised this same discrepancy in the gargantuan complexity of low-level memory management which make it oh so easy to make mistakes and write error-prone software.
Enter Rust. Rust is the perfect example of an evolution in the programming landscape that opens the door to a new generation of programmers. Many programming veterans note a kind of magic that you feel while programming in Rust - something I attribute to the stark contrast between Rust and many of its peers. The syntax and the way in which the language is presented just make it feel good to use, and enables one to see the possibilities that are presented by low level languages.
It is this kind of magic that I experienced as I started programming for the first time. Learning Rust, I was able to break past all the barriers that previously confined me from low-level programming: a forgiving and informative compiler, comprehensive documentation that appeals to beginners and veterans alike, and an accepting and growing community that appreciates newcomers. Despite recent hiccups with overly drastic copyright regulations from the foundation - something I'm sure will be resolved promptly in collaboration with the community - Rust has transformed my experience with low level systems. Rust presents me with an intuitive gateway to finally engage with this aspect of programming that I had long thought could only be achieved through gruelling and monotonous practice fighting against the compiler until I eventually gained the skills needed to be successful. And that, is priceless!
Ferris the crab - Rust's mascot