Go to content

Designing for Ownership - Stefan Baumgartner

Sometimes it’s nice to channel our inner Monica Geller and keep everything neat in our codebase. It’s zen coding when you do some spring cleaning, and it’s good for your team when things are clear and expressive. So you brush up on your tests (or maybe you don’t) and start with some recreational refactoring in Rust. But suddenly, all your textbook refactoring techniques fail! You move code around, extract methods or change coupling, and the borrow checker tells you that everything you want to access has already been used somewhere else. Sorry, Mario, but the Princess is in another castle! In this talk, we will see how we can refactor with ownership in mind. We will learn more about the differences as well as commonalities of pointer types, we will look at how references work when being used in a struct, and we will evaluate what techniques work best. Throughout, we will critically assess whether these changes are worthwhile or if cheating our way around with shortcuts is a better approach. 🦀 *About Stefan Baumgartner* 🦀 Stefan Baumgartner (https://twitter.com/ddprrt) is an architect and developer based in Austria. He is the author of “TypeScript in 50 Lessons” (Smashing Magazine, 2020) and “The TypeScript Cookbook” (O’Reilly, 2023). In his spare time, he organizes ScriptConf and Rust Linz. Stefan enjoys Italian food, Belgian beer, and British vinyl records.

October 10, 2023