SE Radio 670: Matthias Endler on Prototype in Rust
Matthias Endler, Rust developer, open-source maintainer, and consultant through his company Corrode, speaks with SE Radio host Gavin Henry about prototyping in Rust.
They discuss prototyping and why Rust is excellent for prototyping, and Matthias recommends a workflow for it, including what parts of Rust to use, and what parts to avoid at this stage. He describes the key components that Rust provides to help us validate ideas via prototypes, as well as tips and tricks to reach for.
In addition, the conversation explores type inference, unwrap(), expect(), anyhow crate, bacon crate, cargo-script, Rust macros to use, generics, lifetimes, best practices, project layout styles, and how to design through types.
Brought to you by IEEE Computer Society and IEEE Software magazine.
Matthias Endler, Rust developer, open-source maintainer, and consultant through his company Corrode, speaks with SE Radio host Gavin Henry about prototyping in Rust. They discuss prototyping and why Rust is excellent for prototyping, and Matthias recommends a workflow for it, including what parts of Rust to use, and what parts to avoid at this stage. He describes the key components that Rust provides to help us validate ideas via prototypes, as well as tips and tricks to reach for. In addition, the conversation explores type inference, unwrap(), expect(), anyhow crate, bacon crate, cargo-script, Rust macros to use, generics, lifetimes, best practices, project layout styles, and how to design through types.
Brought to you by IEEE Computer Society and IEEE Software magazine.
Show Notes
Related Episodes
- SE Radio 490: Tim McNamara on Rust 2021 Edition
- SE Radio 644: Tim McNamara on Error Handling in Rust
- SE Radio 604: Karl Wiegers and Candase Hokanson on Software Requirements Essentials
Other References
- LinkedIn: MatthiasEndler
- Crates.io: Anyhow
- Crates.io: Bacon
- Crates.io: Cargo script
Transcript
Transcript brought to you by IEEE Software magazine.
This transcript was automatically generated. To suggest improvements in the text, please contact [email protected] and include the episode number and URL.
Gavin Henry 00:00:18 Welcome to Software Engineering Radio. I’m your host Gavin Henry. And today my guest is Matthias Endler. Matthias is a Rust developer and open-source maintainer with 20 years of experience who provides training and consulting through his company called Corrode. Beyond writing clean code, he prioritizes creating supportive environments where teams can grow their rough skills together. Matthias welcome to Software Engineering Radio. Is there anything I missed in your bio that you’d like to add?
Matthias Endler 00:00:45 No, that pretty much sums it up. Thanks for having me, Gavin.
Gavin Henry 00:00:48 Perfect, my pleasure. So I got you on the show because I saw your blog post, really enjoyed it and it was called Prototyping and Rust.
Matthias Endler 00:00:57 Yes.
Gavin Henry 00:00:58 It helped me understand how to take my idea and try to validate it in Rust, which isn’t something you usually hear. So I thought I’d get you on to chat over your techniques and go through some of the things that might help other people get into Rust for the first time or reach for it when they want to do that prototype. So let’s lay down some foundations. Could you give me an overview of what a prototype is?
Matthias Endler 00:01:23 Sure. Well, I like to compare it with art. When you try to paint a picture, you don’t really have to start from the top and go all the way to the bottom. Usually you try to capture the main idea as quickly as possible before it goes away. And so maybe you can start with a sketch and a prototype is like a sketch. It turns out that programming itself is a very iterative process. We do believe that when we read the program in the end the ideas are there and we thought about these ideas from the get-go, which is not true. In reality we also sketch out certain parts of our application as we go, and this is what a prototype is. It starts as a quick draft of what we have in mind and then we iterate on it.
Gavin Henry 00:02:15 Thanks. Do we keep it or do we throw it away? Because I’ve heard other explanations. I think it’s in the pragmatic programmer book where they say a prototype is something you’ve been, but I don’t know. What do you think?
Matthias Endler 00:02:28 That’s a good point. I think a lot of people when they think about prototypes, they have this idea of a throwaway product or project in mind. We will throw it away anyway, but I think it’s an orthogonal question that is besides the question of whether to prototype or not or what a prototype looks like, because in reality it doesn’t really matter if you’re happy with the result, you can keep it, you can iterate on it. But the main point is that you’re trying to get an idea from your brain into some sort of text format. And this is the main core idea. It helps you find the best approach before committing to a design. Whether you keep it or not in the end is completely up to you, completely up to the complexity of the project, the team you work with and all of these things that are maybe even outside of your control. Maybe your manager will say, we will go forward with it. And I would say that’s a positive thing even because you start it with the right idea, but prototyping is like hatching your risks because if you start with the wrong idea, you can happily throw it away and you didn’t lose a lot of time.
Gavin Henry 00:03:41 I like that explanation. Also in my experience, it gives you a different mindset because you’re thinking this is a prototype, I don’t need to care too much about it. I can, you know, whereas if you’re starting the real thing than you’re thinking, oh, I need to get this right, I need to do this, I need to do that. So maybe it’s a bit more freeing because it’s got that label on it. So should a prototype be in the same programming language that we think the final or production version’s going to be? Or should it just be something that gives us that freedom or what’s your thoughts?
Matthias Endler 00:04:14 One huge advantage of using the same language and the same tool set, especially for the prototype and the final version is that you don’t have to go through the rewrite. And the rewrite in quotes is the process of going from your decent idea to quote unquote production code. Now if you have to change the language, then you might make mistakes or maybe the patterns that you use in one language, they don’t translate to another language. So you kind of end up in a weird situation where maybe you try to bite off too much or you probably end up with two problems. One would be the translation from one language to the other, and the other would be making it idiomatic again in the other language that you chose for production. So I would say if you can, keep it in the same language, ideally you would want to use the same language.
[...]