Being a company that specialises in building software for the JVM using mostly Kotlin (but still Java at times, we still love Java), doesn’t mean we do not have an interest for other languages. For the second meetup in 2021 we opted to look into Rust, a systems programming language that has gotten a lot of traction. We were very interested to find out what all the fuss was about.
Rust has been amassing a lot of critical acclaim, steadily becoming more and more popular after its initial release in July of 2010. While not surpassing competitors such as Go and C /C++ (yet), it has over time risen to a highest position of #18 in the Tiobe index. — although it is very much debatable how much that really says about a programming language — which surely would warrant a closer look.
Within the team there was not prior knowledge of Rust. We are all experienced programmers, so most of the concepts turned out to be familiar. Some of us had some experience in programming with Go and C or C++ so we had a bit of an idea what we were getting into. We started out by watching a video that had set explaining Rust as its goal, and was aptly named “What is Rust?”, linked below.
While very entertaining and informative, the code examples were interesting, as they highlighted some Rust code but not really the concepts behind it, which left us curious about why certain bits of code had to be written in that specific way.
Nothing quenches the thirst for knowledge better than just taking the plunge, diving head first into the content. For the second part of the meetup we opted to go for a (long!) video that went into detail on the ecosystem for Rust and the many facets of the programming language. This turned out to be very entertaining, and we were all happily coding along with the provided examples to learn the whats and hows of Rust.
After ploughing through the videos, and writing code with Rust we’ve learned a couple of things:
- Coming from a language that relies on garbage collection to clear system memory of unused references, it’s nice to see a language take a different approach, where you explicitly scope the lifetime of references and which scopes they survive;
- Rust is fast, when doing low-level systems programming this is of the essence, and being able to compile to native executables that just run very quickly is great, especially when comparing it to an interpreted language such as Java;
- Rust provides tools to guarantee thread-safety which is always a tricky thing to do in programming. A lot of mistakes are caught by the compiler, preventing you from making them at runtime;
- The Rust compiler also provides very detailed feedback, it is really clear on what’s wrong with your code and in a lot of cases provides a suggested fix, which is very nice;
- Tool support is also quite good, with the cargo build system and plug-ins for our favourite IDE IntelliJ we could get started very quickly and without any pain.
So, does this mean we are going to abandon our beloved JVM to focus on Rust development? No. We somehow scarcely find ourselves in a situation that simply requires using a language like Rust. But, if we might find ourselves in dire need of a systems programming language in the future, the rich feature set including thread-safety, memory safety and high performance can make Rust a strong contender for the job. It has been a great first introduction to the language and we can definitely see the appeal.
…and then there were drinks
Facilitated by Sourcelabs’ own Lonneke, we all received a great care package containing a couple of great drinks and finger foods (alcoholic, non-alcoholic and even vegan depending on preference) so we can close off the day with a bit of online fun, enjoying each others company. Hopefully we will be able to meet again in person soon and continue our tradition of fine dining after our meetups!