Spreading The Love of Rust
2016 has been an exciting in terms of personal learning and growth. For starter, I decided to let go of my full time position as a university teacher and and run my 2 companies, Framework and Labtek Indie on a daily basis. This itself has presented me with heaps of things to learn. The technical side, however, gave me something even better.
Earlier this year, I set my own things to learn in 2016, which includes Clojure and Machine Learning, among others, for various reasons. That didn’t work as planned. Yes, I did learn some basics of Machine Learning, but I didn’t manage to learn a lot about Clojure. That’s because, Asep, fellow co-founder of Framework, introduced me to Rust based on the premise that I love to code game and 3D stuffs and Rust looks like a nice alternative to C++.
So, I gave it a go and got hooked straightaway. The promise of the absence of null pointer and segfaults is more than enough to make me stay.
Not long after that, we contacted Mozilla Indonesia, asking about how we can use their space as a place to run Framework’s classes. On that meeting, we learned that Mozilla Indonesia need to teach public about Rust (or at least introduce it to the masses), but they lacked resource to do so. Therefore, we decided to step up and give a hand.
Now, introducing a new programming language, is no easy task. Especially in case of Rust, which itself, hosts numbers of new core concepts that won’t be easily grasped, if one hasn’t been exposed enough to lower level computer architecture. That task goes even trickier because, usually I talk about a concept by using analogies or implementation (that works based on my previous experience). But Rust can be implemented in many fields, that talking about only a certain project seems unfair. I’ve introduced C to freshmen before, but that was during a course of a semester. How can I do so when I only have max 2 hours of talk? Should I just talk about the syntax? Or should I focus on the “Ownership and Borrowing” concept? What’s the prime example that I can give?
Long story short, by 6th December 2016, I’ve given 5 introductory talks to Rust, to people who never heard of Rust before, or have minimal knowledge about it. Here’s what I talked about on those 5 occasions.
1. Visual fun With Rust was the title of my first ever Rust presentation. Here, I cushioned with my background as a creative coder and decided to tell story about 3D programming using Rust, mostly because I think it’s low level enough to harness the power of Rust while at the same time I can show how Rust talk to and compared to C. I mainly present the Glium crate using several code examples from its repo. This talk ran for 45 minutes and preceded by Asep gave an introduction to Rust and some of its concept. We gave this talk at Mozspace Jakarta.
Result: This didn’t go out as planned. I don’t think this perfectly illustrates Rust, because the material was pretty alien to most of the audience, who mostly are web developers with experience in PHP. They never experienced a segfault, let alone familiar with GL calls. So it’s back to the drawing board for me.
2. Introduction to Rust was the title of my next presentation. Here, I decided to make it more fun, by first introducing to the core concept of Rust for the first half of the talk and then give the audience a hands-on experience of using Rust, courtesy of Carol Nichol’s rustlings, while explaining the syntax. Afterwards, I showed a demo of a web server built with Rust, as an example of a real world (or at least close to) application. Again, this talk was conducted in Mozspace Jakarta and this time, I went solo.
Result : This worked very well. The audience managed to pick up the language and were very engaged to the presentation. The hands-on training was very helpful to illustrate some of the core concept and practice of using Rust. That also helped them understanding how the web server worked when I showed the code.
3. Introduction to Rust was the third time I gave talk about Rust and I basically presented the same material as before. If it ain’t broken, don’t fix it.
Result : Again, the result was roughly the same as before. The audience were mostly students who just got introduced to C++. I guess that helped them understanding some of the concepts discussed here.
Between this and the 4th talk, I decided to create a web back end boilerplate project using Rust that talks to a MySQL database and can be accessed via API. I open sourced this and documented in Indonesia, hoping that it’ll help accelerate the process of learning Rust for fellow Indonesians. At least, the language barrier is minimised.
4. Hipster Tech Meetup was the fourth time I gave a talk about Rust. This time, me and Asep used this opportunity to introduce both Elm and Rust. So first, I introduced Rust, then Asep introduced Elm and in the end, we showcased a demo of building a website that uses Rust as the backend and Elm as its front end. It was a quickly developed demo, aimed to illustrate what both language can do. I also touched a bit of the functional programming side of Rust to go with the style of Elm.
Material wise, I iterate on the previous session. I removed the hands-on session, because there’s not enough time. To replace that, I give tour on Rust syntax via an example program. I also give more time to explain Ownership and Borrowing, implemented there, in that program. Again, Mozspace Jakarta was where the event held.
Result : This ended up well. I think many people came for Elm so it was good to expose them to a little bit of Rust. Some back and forth discussions happen after we showed our small example app. That’s a good sign that the audience get what we were talking about.
5. Midtrans dev-x Meetup. Midtrans is a one of the famous startup, here in Jakarta and they make a payment gateway system. They also regularly host developer meetup and this time I got invited to talk about Rust. Again, I iterated the previous slide, cut some confusing bits and touch on easier to grasp features (i.e: I explain zero-cost abstraction, instead of trait-based generics). I didn’t deviate much though, but I prepared myself more to give a more thorough explanation. Not much time to talk, so the hands-on session was absent.
Result: I absolutely loved this one. The audience were very active and interested, many questions popped up and I engaged in more discussions after the event ended. Questions include using Rust in production, the future of the language (will it break after updating?), concurrency and its ideal application among others. I was very happy that my presentation triggered many of those questions. Not to mention, this was the most number of people showed up when I talked about Rust. I felt like I finally nailed it.
To summarise, I feel introducing the concept of Rust via the tour of the syntax and example application does the job well. Most of the developers I’ve encountered are web developers, so the web server application did its part well. Also, the compiler is a very nice feature of Rust and explaining its part in the whole workflow of coding with Rust is a nice point to touch on. Not to mention, telling what I’ve gained after learning Rust is a worthy material, since it really has taught me a lot, from the perspective of both computer architecture and programming language as a tool.
Next year, I’m planning to give more talk about Rust while at the same time trying to implement Rust in one of my pet project, or maybe even Labtek Indie’s. I believe that, since the engaged audiences so far are mostly web developers, topic like optimising a node.js app with Rust or even concurrency would be very good to deliver in the future. I think it will properly showcase the strength of Rust and reasoning behind its design. Also, I need to actually contribute in translating Rust documentation to Indonesia. My bad.
Kudos to all the great people in the Rust community (those in Twitter and SO deserves special mentions) that helped me a lot in understanding this exciting programming language.
Here’s to 2017.
Note: almost on every presentation, people always ask the difference between Rust and Go. I feel like this needs a special post or even presentation from my side. It’s not really apple to apple per se, but I believe answering it will quench some thirsts.