Why am I learning Rust?
Nirmalya Sengupta
Posted on April 4, 2023
The Build-up
I met Debasis Basu (LinkedIn) at a social event, a few weeks ago.
Debasis is a childhood friend. We studied at the same residential high-school and spent six of our formative years together: a brilliant student (much better than I have been 😁) and an excellent sportsperson (again, much ahead of me 😞), Debasis has had an outstanding career for over 35 years, after graduating from IIT, Kharagpur, India. A keen observer of the goings-on, in the technology industry, Debasis has this habit of putting me off-guard, by asking relevant, pointed and interesting questions. I fumble but then, I become aware of gaps between what I know and what I think I know.
This time, too, Debasis threw a seemingly simple question at me: why are you learning Rust? What is it that you can do using Rust, that you cannot do using say, 'C'?
I put up a brave face, thought on my feet and mumbled something. It quickly became obvious to me, that my effort did not leave any much effect on him. He looked plainly unimpressed.
Later, I played the conversation in my mind. If I could not tell Debasis - who has (more than) the requisite background and was genuinely all ears - reasonably convincingly why I was learning Rust, what chance did I have to tell someone else, having much less attention to and much less time for, what I had to say? More importantly, did I ever tell myself why would I like to learn Rust?
So, I decided to put together my thoughts into a more coherent form, but I will begin with a quote I have remained very, very fond of:
A language that doesn't affect the way you think about programming, is not worth knowing.
-- Alan Perlis
Learning a new language makes me think differently from what I am used to
Rust is a systems programming language. I have developed non-trivial software using 'C' in the first decade and a half of my career. That was my first - and so far, last - fortuitous association with what is called systems programming. A compact language, having 32 keywords, 'C' propounded a philosophy of doing a lot by saying a little. Being a low_level language, it provided powerful constructs that allowed me - the programmer - to go very near to the world where the machine ruled. The fall-out was a huge responsibility on me to be 'right' along the entire flow from very near to the user application to very near to the machine. The price to pay for being inattentive could be disatrous. The power was intoxicating for a programmer and the responsibility was unnerving. The long nights spent in following a wayward pointer are still etched in my mind.
Rust brings in a different philosophy. The Rust compiler has strict rules and it employs them ruthlessly. Armed with these rules, it tries to foresee where my code can go wrong when it runs, even when I haven't been careful. This changes the game altogether. The compiler can see what I - the programmer - have possibly failed to see and then, by throwing compile-time errors, the compiler refuses to let me move ahead. Thus, to satisfy the compiler, I am forced to consider implications of my code while writing it:
- is a variable associated with right data type througout its usage?
- is a pointer dangling dangerously?
- is a piece of memory being used incautiously by two threads? and such.
The important point is that the compiler doesn't let me proceed with such vulnerabilities. Consequently, in order to run my program, I have to think the way the compiler is thinking. This forced co-thinking with a very smart and powerful compiler has its benefits: I am made to think more precisely than I am used to. It helps sharpen my programming thinking.
I feel welcome. Yes, that matters.
From the very first time I stepped in the world of Rust, I felt that folks in the community were all extending a helping hand. Documentations were crisp and clear. Tutorials were meant to coach me and not just to take me to quick end of an example. Exercises were usefully graded, with appropriate hints to assist. Videos (on youtube) varied from simple features to complex concepts, without being patronizing.
Now, one may raise the eyebrow and wonder how do all these make Rust special? Are proponents and practitioners of other, newer languages any different?
Well, I will be honest. I cannot knowledgeably comment on how is the state of affairs with long list of other languages. I know and professionally work (have worked) with a few of them. I have dabbled with a couple of others. Thus, the background with which I say this, is quite limited.
It is not that I decided to jump into Rust without any consideration. I had been watching Rust from the fence for some time. I have spent time watching video clips, listening to podcasts and of course, reading blogs as well as discussion-threads in 'Stackoverflow' and 'reddit'. Like I mentioned earlier, Rust indeed has many quirks, some of which are quite inscrutable at the beginning. At times, this is definitely frustrating.
Countless enthusiastic newbies like me threw (and are throwing) in questions, ranging from eye-opener-types to eye-rolling-in-socket-types. However, I didn't find responses which were dismissive in nature and in tone. One may argue that the sample-set is too small, but I did sense the care and the wardship of the Rust experts who proffered their responses. It was as if they knew that the language brought in approaches which, a large swath of mainstream programmers hadn't heard about, let alone being comfortable. These programmers needed calming hands on their shoulders while they joined the community.
Praising by practitioners, backing by biggies
Even though large corporations of the world of software are not particularly loved for their large-heartedness 😉, it is undeniable that their endorsement of a technology matters. A programming language's uptake gets a shot in the arm, when they announce their support, contribute to the effort and in the process, keep generations of programmers enthused. Java, Javascript (nodeJS to be a little more accurate), Swift etc. good examples.
Rust has made some of the biggies interested and that is a good news. Amazon,, Microsoft and Cloudflare have endorsed it and have put up production versions of some of their offerings.
Several publicly available datasets indicate that Rust has a significant following and the trend doesn't seem to wane.
TIOBE Index confirms the upward trend, but Rust decidedly has a long distance to cover.
Redmonk suggests in its June'2022 report that "it seems increasingly clear that the hypothesis of a temporary equilibrium of programming language usage is supported by the evidence". If this indeed is the case, Rust has a steep upwards climb ahead, from its current position of 19 out of 20.
According to statisticstimes.com, Rust is showing slow yet steady progress upwards in popularity in countries like US, Germany, France, UK and in India!
So, there's something going on with Rust. Will it sustain (or accelerate) its current rate of adoption? Time will tell.
So, where do I find myself?
Well, I am not a soothsayer. I cannot and certainly don't want to, predict the fate of Rust. I feel that Rust very unlikely to dethrone Python or Javascript based on number of deployed applications. It is also unlikely to challenge Java (and other JVM based languages) for enterprise-focused, large, server-side application, meaningfully. It will possibly remain a niche language, used for specific purposes and by a smaller segment of the tech-industry. Having said that, I also feel that these specific, niche areas will only increase in number. Hopefully, the time and effort that I am investing in learning and mastering Rust, will not go in vain.
So, this is all that I have to say to Debasis 🤗.
I have steadfastly kept away from the technical features of Rust, their power and their usage-patterns and the cautionary steps which the experts remind the new entrants. Debasis was not interested about those in any case and this blog is primarily meant to give a compact and honest answer to the question he posed, during a sumptuous dinner in Kolkata, India.
Posted on April 4, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.