Imagine you are out to dinner with some friends. You are all stereotypical Millennials so photographing your meal is expected. For every dish you order each of your friends borrows it, takes a photograph, and then returns it to you.
Well, that’s the plan anyway. Some of your friends are not the most reliable. Will they always return the right dish to you? Will they try to sneak a bite? Human friends are so unreliable. But if your friends were Rust functions you’d have nothing to worry about, thanks to Rust’s rules around borrowing and lifetimes.
Let’s model this dinner party in Rust and see if we can learn a thing or two about borrowing and lifetimes.Read More
For the past few months I’ve been contributing to Exercism.io, mostly by expanding the Rust track and helping to standardize the problems across languages. It’s fun, and I think the recent upswing in contributors to Exercism has helped the site significantly.
Case in point: an Exercism student, smarter than myself, did an awesome thing and submitted an issue.
Submitting an issue may not seem like much. “Salty Randos” (as Justin Searls calls them) submit issues all the time, right? But this issue was different. The student was honestly confessing that the Anagram problem that was too hard for beginners. That, like I said, is an awesome thing. Programmers (well, all people, probably) don’t like to say, “This is too hard”. Especially when the thing that’s too hard is a toy programming problem meant to help you learn.
What made this issue all the more pressing for me was that I knew about the problem. I’d just forgotten. I began learning Rust with the leap year problem, which was fun. So I continued on to Anagram.
Where I hit a massive wall.Read More
I have a couple of ideas about learning programming languages.
The first is that we do it wrong. I’m sure you’ve experienced this. You try learning a new language and can’t quite see how it all works. Why do I use this syntax here and some other syntax over here? We get frustrated by all the weird bits and go back to a language we know.
I think we do a bad job of learning languages because of how we think about languages. Think back to the last time you discussed a new language. Someone mentioned a new language and then someone else asked about the language’s speed, syntax or web framework of choice.
This is similar to how we talk about cars. Hear about that new Ford Bratwurst? How fast is it? Can I drive it through a lake?
When we talk about languages this way, we make them sound interchangeable. Like cars. I know how to drive a Toyota Hamhock, so I should be able to drive a Ford Bratwurst, no problem. Only the speed and the dashboard vary, right?
But imagine what a PHP car would look like, now imagine how different the Lisp car would be. Moving from one to the other involves a lot more than learning which knob controls the heater.Read More
Recently I helped organize some Sandi Metz training at the University of Minnesota. It was great and I highly recommend you bring Sandi to your place of employment or that you attend one of her public courses.
During class we discussed factory methods and the different ways of implementing them. But we didn’t have enough time time to dive in to the options. I told my classmates that I would write something up, so here it is – a guided tour of factories from the simple to the ridiculous!Read More
This is it, the home stretch. In the 3 previous articles we’ve learned a lot about Rust (like Strings, Arrays and Lifetimes), but we haven’t actually written the code that started us down this path – finding anagrams of words. Today we will write that code.Read More